官方说明
安装
1 2 3 4 5 6
| sudo yum install yum-utils
vi /etc/yum.repos.d/nginx.repo
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| [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
|
1 2 3 4 5
| sudo yum-config-manager --enable nginx-mainline
sudo yum install nginx
|
其他配置
1 2 3 4 5
| systemctl start nginx systemctl status nginx systemctl stop nginx systemctl restart nginx systemctl enable nginx
|
1 2
| nginx -s reload nginx -t
|
注意,修改配置后,一定要用 nginx -s reload 使配置生效。 再重启服务器