安装最新nginx 本文共有1584个字,关键词: ubuntu 添加Nginx官方的源: ``` sudo tee /etc/apt/sources.list.d/nginx.list << EOF deb http://nginx.org/packages/mainline/ubuntu `lsb_release -cs` nginx deb-src http://nginx.org/packages/mainline/ubuntu `lsb_release -cs` nginx EOF ``` 添加Nginx的公钥: ``` wget http://nginx.org/keys/nginx_signing.key sudo apt-key add nginx_signing.key ``` ``` sudo apt update sudo apt install nginx ``` ``` #官方指导 sudo apt install curl gnupg2 ca-certificates lsb-release ubuntu-keyring curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor \ | sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null gpg --dry-run --quiet --no-keyring --import --import-options import-show /usr/share/keyrings/nginx-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \ http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" \ | sudo tee /etc/apt/sources.list.d/nginx.list echo -e "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" \ | sudo tee /etc/apt/preferences.d/99nginx To install nginx, run the following commands: sudo apt update sudo apt install nginx ``` centos 关闭selinux 做转发时 有可能nginx报权限错误,需关闭selinux setenforce 0 sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/‘ /etc/selinux/config;cat /etc/selinux/config 或者 vim /etc/selinux/config文件 将SELINUX=disabled 添加yum源 rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm 安装 yum install nginx 启动 systemctl enable nginx systemctl start nginx 「一键投喂 软糖/蛋糕/布丁/牛奶/冰阔乐!」 赞赏 × 梦白沙 (๑>ڡ<)☆谢谢老板~ 1元 2元 5元 10元 50元 任意金额 2元 使用微信扫描二维码完成支付 版权声明:本文为作者原创,如需转载须联系作者本人同意,未经作者本人同意不得擅自转载。 随手发现 2022-06-29 评论 257 次浏览