403禁止访问解决
1、
重要:修改配置文件使用虚拟机,否则怎么配置都不生效,添加如下用户
[root@host-10-1-1-161 html]# ll /etc/nginx/nginx.conf
-rw-r--r-- 1 root root 345 Aug 26 10:41 /etc/nginx/nginx.conf
[root@host-10-1-1-161 html]# vi /etc/nginx/nginx.conf
user root root;
worker_processes 1;
2、
加上 index.php
index index.html index.php
3. 不要写成 test1.index.html 务必改成 index.html 多写个目录就多写几个目录
503访问错误解决
[root@host-10-1-1-161 ~]# curl oa.test.com
<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.12.2</center>
</body>
</html>
原因:防火墙没有关
解决:
[root@host-10-1-1-103 tomcat]# systemctl stop iptables
[root@host-10-1-1-103 tomcat]# systemctl stop firewalld
nginx [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 reload
nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored
修改nginx配置参数后,使用nginx -t检查配置.
提示successfull后就可以使用 nginx -s reload来重新加载配置
nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored
意思是重复绑定了server name,但这个警告不会影响到服务器运行。
而且,这个重复绑定的意思是现在运行的nginx服务和将要加载的新配置中的重复