hosts(linux或windows) 没有解析
[root@web01 /etc/nginx]# curl blog.oldboy.com
Found.
检查nginx服务是否启动,systemctl status nginx
root@web01 /etc/nginx]# curl www.oldboy.com
curl: (7) Failed connect to www.oldboy.com:80; Connection refused
[root@web01 ~]# nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
启动或重启nginx 的报错
[root@web-204 html]# systemctl start nginx
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
解决:
1>直接在命令行journalctl -xe查看详细的错误提示
2>用nginx -t 检查语法是否错误
[root@web-204 html]# nginx -t
nginx: [emerg] unexpected "}" in /etc/nginx/nginx.conf:49
nginx: configuration file /etc/nginx/nginx.conf test failed
\\\}不成对
server_name 这一行 没有以 ";" 结尾
terminated 结束
[root@wed01 ~]# nginx -t
nginx: [emerg] directive "server_name" is not terminated by ";" in /etc/nginx/nginx.conf:43
nginx: configuration file /etc/nginx/nginx.conf test failed
1>网站首页的权限拒绝
2>网站首页不存在(默认找首页文件)
[root@web01 /usr/share/nginx/html/blog]# curl blog.oldboy.com
403 Forbidden
403 Forbidden
nginx/1.16.0
站点目录下没有aaa.html这个文件
[root@web01 /usr/share/nginx/html/www]# curl www.oldboy.com/aaa.html
404 Not Found
404 Not Found
nginx/1.16.0
本地没有10.0.0.9这个ip
[root@web01 /etc/nginx]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] bind() to 10.0.0.9:80 failed (99: Cannot assign requested address)
nginx: configuration file /etc/nginx/nginx.conf test failed
解决:ip addr add 10.0.0.9/24 dev eth0 label eth0:1
有两个几个 虚拟主机的域名相同了
[root 12:27:17 @web01 conf.d]# nginx -t
nginx: [warn] conflicting server name "www.oldboy.com" on 0.0.0.0:80, ignored
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
解决:用grep检索查询server标签文件中存在www.oldboy.com的文件,有多个将其中1一个注释或改名
1>检查nginx的配置是否有误
2>当后缀为php时,给秘书php-fpm没有指定站点目录
[root@web01 /etc/nginx/conf.d]# curl www.new1983.com/info.php
File not found.
[root@web01 /etc/php-fpm.d]# systemctl restart php-fpm.service
Job for php-fpm.service failed because the control process exited with error code. See "systemctl status php-fpm.service" and "journalctl -xe" for details.
[root@web01 /etc/php-fpm.d]#
测试nginx与php是否联通时,出现的这个错
原因:
1>php-fpm.service服务没有启动,启动或重启即可
在系统中没有创建数据库
1>站点目录连接数据库的账号、密码错误
删除nginx用户时,提示该用户正在被7259进程使用
[root@web02 ~]# userdel nginx
userdel: user nginx is currently used by process 7259
解决:先停止使用该用户的服务systemctl stop nginx php-fpm.service,再删除
需要授权的意思,一般是认证失败(用户名和密码)
内部服务器错误或程序错误
原因:
1>防火墙、SELinux
2>是否能连接到虚拟机(失联)