安装
添加安装源,可以参考
vi /etc/yum.repos.d/nginx.repo[nginx]name=nginx repobaseurl=http://nginx.org/packages/centos/$releasever/$basearch/gpgcheck=0enabled=1
安装
yum install nginx
配置
开机自启动
systemctl enable nginx
以nobody用户运行,需重启应用生效
vi /etc/nginx/nginx.confuser nobody;
启动或重启
systemctl start nginxsystemctl restart nginx
允许外网访问
firewall-cmd --zone=public --permanent --add-service=httpfirewall-cmd --reload