[コレクション]障害Nginx-

*インデックス

1.Connectionが拒否されました nginxのサービスが実行されていません
/etc/nginx/nginx.confで2.unexpected "}" 設定ファイルの構文エラーの内容
3.Linux窓またはドメイン名を使用して ホストは、ドメイン名を解決しませんでした
でtreminatedない4.is 終わっていません...
5.404が見つかりません サイトのディレクトリが作成された、または設定ファイルnginx.conf間違ったサイトディレクトリすることはできません
6.403禁断のアクセス許可が拒否されました 許可(最初の)拒否
7.403禁断のアクセス許可が拒否されました ホーム・ファイルは、(第2)が存在しません
8.Cannotアサイン要求されたアドレス 要求された指定されたIPアドレスを割り当てることができません
9.304は変更されません ブラウザのキャッシュを読み取るために、ユーザを(プロンプト)
すでに使用中の10.Address すでに使用中のアドレス
11.Connectionが拒否されました 接続が拒否されました
12.矛盾するサーバー名 サーバー名の競合
13.500内部サーバーエラー 内部サーバーエラー

1.Nginxサービスが実行されていない内部サーバーエラー

80ポートが開いていない
nginxのサービスは、nginxの再起動systemctl再起動します


16952149-d09b5c52b52239bd.png
[17:10 root@web01 /etc/nginx/conf.d]# curl www.oldboy.com
curl: (7) Failed connect to www.oldboy.com:80; Connection refused
[17:10 root@web01 /etc/nginx/conf.d]# systemctl restart nginx
[17:10 root@web01 /etc/nginx/conf.d]# curl www.oldboy.com
www.oldboy.com

2. [詳細nginxのnginxの-t構文エラーチェック

バオは、設定ファイルの内容の構文エラーの一般的な説明かっこ
「}」不対を

systemctl  
[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.

[root@web-204 html]# nginx -t
nginx: [emerg] unexpected "}" in /etc/nginx/nginx.conf:49
nginx: configuration file /etc/nginx/nginx.conf test failed
16952149-08722306b92573a4.png

3./etc/hostsファイルには、ドメイン名を解決しません。

[root@web01 /etc/nginx]# curl blog.oldboy.com
<a href="https://www.afternic.com/forsale/blog.oldboy.com?utm_source=TDFS_DASLNC&amp;utm_medium=DASLNC&amp;utm_campaign=TDFS_DASLNC&amp;traffic_type=TDFS_DASLNC&amp;traffic_id=daslnc&amp;">Found</a>.
16952149-4b421eb0a2a674fa.png

4.server_nameこの行は、セミコロンで終わっていません「;」

treminated終了
 40     server   {
 41         listen       80;
 42         server_name  blog.oldboy.com   \\没有以 ; 结尾
 43         location / {
 44         root   /usr/share/nginx/html/blog;
 45         index  index.html index.htm;
 46         }
 47     }
 48 
 49 }
16952149-3f46eaae8312ee1e.png

5.見つからないエラー-404

サイトのディレクトリが作成された、または設定ファイルnginx.conf間違ったサイトディレクトリすることはできません
[root@web01 ~]# cat /usr/share/nginx/html/{www,blog}/index.html
www.oldboy.com
blog.oldboy.com
[root@web01 ~]# curl blog.oldboy.com
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>

* * *

<center>nginx/1.16.0</center>
</body>
</html
16952149-322377177f31d6f8.png

6.許可拒否エラー-403(第一)

禁断のアクセス許可が拒否されました
16952149-eb4c887515cf9e70.png

アナログエラー:ディレクトリのパーミッションがバック644から000へのテストの後にサイトを変更するには:

[09:34 root@web01 ~]# ll  /usr/share/nginx/html/www/
total 4
-rw-r--r-- 1 root root 15 Jun  5 09:00 index.html
[09:35 root@web01 ~]# chmod 600 index.html
[09:35 root@web01 ~]#  ls -l index.html 
-rw------- 1 root root 15 Jun  5 09:00 index.html
[09:35 root@web01 ~]# curl www.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.エラー-403ホームファイルは、(第2)が存在しません

ファイルを見つけるためにホームはデフォルトのホーム・ページ・ファイルは存在しません。
16952149-7dab371f5ca5a497.png

他の場所でアナログサイトディレクトリへの移動:

[16:35 root@web01 ~]# mv /usr/share/nginx/html/www/index.html /tmp/
[16:35 root@web01 ~]# curl www.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>

8.要求されたアドレスが要求されたアドレスのIPを指定するために割り当てることができません割り当てることができません

ローカルIPん10.0.0.9
10.0.0.9:80(failedCannotアサイン)

[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

解決策1:IPアドレスを追加します。

[root@web01 ~]# ip addr add 10.0.0.9/24 dev eth0 label eth0:1   \\添加此ip

9. 304変更されていないユーザーは、ブラウザのキャッシュを読み込みます

/var/log/nginx/access.logログ表示304

16952149-e4211c7d130c3a54.png

10.Addressは、すでに使用中のアドレスが既に使用されています

nginxのは、80ポートの使用して、起動されている
だけのヒントを、ないエラー
、既に使用中のアドレス
nginxのは、実行されています


16952149-71dcc8a3a069d74c.png

11.Connectionは、接続が拒否拒否しました

[16:25 root@web01 ~]# curl www.oldboy.com
curl: (7) Failed connect to www.oldboy.com:80; Connection refused
[16:25 root@web01 ~]# systemctl restart nginx
[16:25 root@web01 ~]# curl www.oldboy.com
www.oldboy.com

12.競合サーバー名サーバー名の競合

紛争のドメイン:2つの以上の仮想ホストが同じドメイン名がある
解決策:デフォルトの圧縮は、default.confを変更することができます

 [root 12:27:22 @web01 conf.d]# vim 01-www.conf 

server {
      listen    80;
      server_name     www.oldboy.com;  \\域名重复
      #charset koi8-r;
      access_log  /var/log/nginx/access_www.log  main;

      location / {
          root   /usr/share/nginx/html/www;
          index  index.html index.htm;
                }
     }

[root 12:35:02 @web01 conf.d]# cat default.conf
server {
    listen       80;
    server_name  www.oldboy.com;   \\域名重复
    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }
}
[16:52 root@web01 /etc/nginx/conf.d]# gzip  default.conf
[16:52 root@web01 /etc/nginx/conf.d]# ll
total 16
-rw-r--r-- 1 root root 219 Jun  5 12:56 01-www.conf
-rw-r--r-- 1 root root 240 Jun  5 12:55 02-blog.conf
-rw-r--r-- 1 root root 488 Apr 23 22:34 default.conf.gz  \\压缩
-rw-r--r-- 1 root root 123 Jun  5 12:41 status.conf

13.500内部サーバーエラー

内部サーバーエラーは、
認証局auth_basic_user_fileセットアップ
正しいパスワードファイルのアクセス権を


16952149-3169b774db85d9d8.png

600へ

[09:45 root@web01 /etc/nginx]# chmod 600 htpasswd 
[09:46 root@web01 /etc/nginx]# ll htpasswd 
-rw------- 1 nginx nginx 45 Jun  6 09:30 htpasswd

ます。https://www.jianshu.com/p/a8223b2e53b5で再現

おすすめ

転載: blog.csdn.net/weixin_34259159/article/details/91060056