403禁止访问解决、重要:修改配置文件使用虚拟机,否则怎么配置都不生效,添加如下用户[root@host---- html]# ll /etc/nginx/nginx.conf
-rw-r--r-- root root Aug : /etc/nginx/nginx.conf
[root@host---- html]# vi /etc/nginx/nginx.conf
user root root;
worker_processes ;、加上 index.php
index index.html index.php. 不要写成 test1.index.html 务必改成 index.html 多写个目录就多写几个目录503访问错误解决[root@host---- ~]# curl oa.test.com
<html>
<head><title> Bad Gateway</title></head>
<body bgcolor="white">
<center><h1> Bad Gateway</h1></center>
<hr><center>nginx/1.12.</center>
</body>
</html>原因:防火墙没有关解决:[root@host---- tomcat]# systemctl stop iptables
[root@host---- tomcat]# systemctl stop firewalldnginx [error] invalid PID number in varrunnginxnginx.pid”解决nginx: [error] invalid PID number “” in “/usr/local/var/run/nginx/nginx.pid”
在Mac上用brew安装Nginx,然后修改Nginx配置文件,再重启时报出如下错误:nginx: [error] invalid PID number "" in "/usr/local/var/run/nginx/nginx.pid"解决办法:$ sudo nginx -c /usr/local/etc/nginx/nginx.conf$ sudo nginx -s reloadnginx: [warn] conflicting server name "localhost" on 0.0.0.0:, ignorednginx: [warn] conflicting server name "localhost" on 0.0.0.0:, ignored
修改nginx配置参数后,使用nginx -t检查配置.提示successfull后就可以使用 nginx -s reload来重新加载配置nginx: [warn] conflicting server name "localhost" on 0.0.0.0:, ignored意思是重复绑定了server name,但这个警告不会影响到服务器运行。而且,这个重复绑定的意思是现在运行的nginx服务和将要加载的新配置中的重复