複数のサーバー名

複数のサーバー名

基本的に毎日午後になるとユーザーに対してフリーズし続ける内部 PHP アプリケーションがあります。以前はアプリケーション (docker) を再起動していましたが、それで 1 日問題は緩和されましたが、完全には解決しませんでした。そこで今日、nginx エラー ログを詳しく調べました。エラーを詳しく調べたところ、リクエストが 172.17.8.101 に送信されたことがわかりました。この IP は開発用にローカルで使用するローカル IP ですが、本番環境にプッシュすると IP は 192.168.254.96 になります。そのため、サーバー ブロックに 2 つの異なる IP を配置できると思いましたが、それは間違いだったに違いありません。

2015/03/03 15:44:44 [error] 42#0: *7006 open() "/var/www/contentlibrary/favicon.ico" failed (2: No such file or directory), client: 192.168.254.63, server: 172.17.8.101, request: "GET /favicon.ico HTTP/1.1", host: "192.168.254.96:8083"
2015/03/03 15:44:44 [error] 42#0: *7006 open() "/var/www/contentlibrary/favicon.ico" failed (2: No such file or directory), client: 192.168.254.63, server: 172.17.8.101, request: "GET /favicon.ico HTTP/1.1", host: "192.168.254.96:8083"
2015/03/03 14:11:17 [error] 40#0: *6715 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 192.168.254.80, server: 172.17.8.101, request: "POST /pagecreator/index.php/page_creator/grouping/getGroupsByContentId HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-fpm.sock", host: "192.168.254.96:8083", referrer: "http://192.168.254.96:8083/app/index.php?user=John%20Doe"
2015/03/03 14:22:15 [error] 40#0: *6726 open() "/var/www/contentlibrary/favicon.ico" failed (2: No such file or directory), client: 192.168.254.63, server: 172.17.8.101, request: "GET /favicon.ico HTTP/1.1", host: "192.168.254.96:8083"

conf ファイル内のサーバー ブロックは複数のサーバー名を使用していました。これは本番環境では問題となるため、2 つの異なるサーバー ブロックを作成せずに開発環境をサポートするにはどうすればよいでしょうか。

include /etc/nginx/conf.d/*.conf;

index  index.php index.html index.htm;

## Content Library
server {
    server_name 172.17.8.101 192.168.254.96; // Problem HERE
    #access_log logs/contentlibrary_access.log;
    root /var/www/contentlibrary;
    #default_type text/html;
    index  index.php index.html index.htm;

    location / {
    }

    location /app{
        try_files $uri $uri/ /index.php /index.php$uri  =404;
        root /var/www/contentlibrary/app;
    }

    location ~* \.(jpg|jpeg|gif|png|html|htm|css|zip|tgz|gz|rar|doc|xls|pdf|ppt|tar|wav|bmp|rtf|swf|flv|txt|xml|docx|xlsx|js)$ {
        try_files $uri $uri/ /index.php$uri =404;
        access_log off;
        expires 30d;
    }

関連情報