1、Linux或windows #使用域名
hosts(linux或windows) 沒有解析
[root@web01 /etc/nginx]# curl blog.oldboy.com <a href="https://www.afternic.com/forsale/blog.oldboy.com?utm_source=TDFS_
DASLNC&utm_medium=DASLNC&utm_campaign=TDFS_DASLNC&traffic_type=TDFS_DASLNC&traffic_id=daslnc&">Found</a>.
2、Connection refused #連接拒絕
檢查nginx服務是否啟動,systemctl status nginx
root@web01 /etc/nginx]# curl www.oldboy.com curl: (7) Failed connect to www.oldboy.com:80; Connection refused
3、Address already in use #nginx正在運行中
[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()
4、journalctl -xe
啟動或重啟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 }不成對
5、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
6、403 Forbidden #被拒絕
1>網站首頁的權限拒絕 2>網站首頁不存在(默認找首頁文件)
[root@web01 /usr/share/nginx/html/blog]# curl blog.oldboy.com <html> <head><title>403 Forbidden</title></head> <body> <center><h1>403 Forbidden</h1></center> <hr><center>nginx/1.16.0</center> </body> </html>
7、404 Not Found #請求的資源不存在
站點目錄下沒有aaa.html這個文件
[root@web01 /usr/share/nginx/html/www]# curl www.oldboy.com/aaa.html <html> <head><title>404 Not Found</title></head> <body> <center><h1>404 Not Found</h1></center> <hr><center>nginx/1.16.0</center> </body> </html>
8、Cannot assign requested address #無法分配指定的ip地址
本地沒有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
9、conflicting server name #域名沖突
有兩個幾個 虛擬主機的域名相同了
[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標簽文件中存在
10、File not found 找不到文件
1>檢查nginx的配置是否有誤 2>當后綴為php時,給秘書php-fpm沒有指定站點目錄
[root@web01 /etc/nginx/conf.d]# curl www.new1983.com/info.php File not found.
11、journalctl -xe
[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]#
12、502 Bad Gateway
測試nginx與php是否聯通時,出現的這個錯 原因: 1>php-fpm.service服務沒有啟動,啟動或重啟即可
13、Can’t select database 不能選擇數據庫
在系統中沒有創建數據庫
13、Error establishing a database connection #建立數據庫連接時出錯
1>站點目錄連接數據庫的賬號、密碼錯誤
14、user nginx is currently used by process 7259 #用戶nginx當前由進程7259使用
刪除nginx用戶時,提示該用戶正在被7259進程使用
[root@web02 ~]# userdel nginx userdel: user nginx is currently used by process 7259
解決:先停止使用該用戶的服務systemctl stop nginx php-fpm.service,再刪除
15、401 Authorization Required
需要授權的意思,一般是認證失敗(用戶名和密碼)
16、500 Internal Server Error
內部服務器錯誤或程序錯誤
17、No route to host #無法到達主機
原因: 1>防火牆、SELinux