linux 上多种方式安装 nginx,LNMP 安装、YUM 安装
netnr 2018-09-05
# 安装方式:一键安装
wget http://soft.vpser.net/lnmp/lnmp1.9.tar.gz && tar -xvf lnmp1.9.tar.gz && cd lnmp1.9 && ./install.sh nginx
./upgrade.sh nginx  # 升级

# help
https://lnmp.org/install.html


# 安装方式:CentOS7 yum
rpm -Uvh https://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum install nginx


# https://nginx.org/en/linux_packages.html
# 安装方式:dnf 安装,创建以下文件
dnf install dnf-utils
vi /etc/yum.repos.d/nginx.repo

# 内容开始
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
# 内容结束

yum-config-manager --enable nginx-stable # 配置启用,或 --disable 禁用
dnf install nginx # 安装
systemctl start nginx # 启动服务
systemctl enable nginx # 开机启动
登录写评论