0

これは重複した質問である可能性があることを認識していますが、他に誰も助けてくれませんでした(解決策を4日間検索した後)。

Web アプリケーションに nginx + php5-fpm を使用しています。Apacheで問題なく動作したので、構成の問題であることはわかっています。

Web ページが 1 ~ 5 回ロードされますが、ロードされず、毎回 504 ゲートウェイ タイムアウトが発生します。

私の遅いログを見ると、すべての PHP 操作が成功しており、最後の関数も実行されていることがわかります。よくわかりません、これは php5-fpm のせいですか?

スローログ:

[28-Jun-2014 12:45:33]  [pool www] pid 21245
script_filename = /home/XXX/public_html/feed.php
[0x00000000014a48f8] usleep() /home/XXX/cache.class.php:864
[0x00000000014a46c8] addLock() /home/XXX/cache.class.php:902
[0x00000000014a44e0] increment() /home/XXX/channel.class.php:124
[0x00000000014a4200] incrementWorkstamp() /home/XXX/channel.class.php:102
[0x00000000014a3f20] getWorkstamp() /home/XXX/channel.class.php:103
[0x00000000014a2908] getWorkstamp() /home/XXX/public_html/feed.php:162

そして今、スローログでダンプに失敗しました:

[28-Jun-2014 12:52:40]  [pool www] pid 29136
script_filename = /home/XXX/public_html/index.php
[0x00007fd7388d7620] session_start() /home/XXX/headers.php:2
[0x00007fd7388d7068] +++ dump failed

Web アプリケーションの nginx 構成:

server {
    #listen   80; ## listen for ipv4; this line is default and implied
    #listen   [::]:80 default ipv6only=on; ## listen for ipv6

    root /home/XXX/public_html;
    index index.html index.htm index.php;

    # Make site accessible from http://localhost/
    server_name localhost;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to index.html
        try_files $uri $uri/ /index.php?$query_string;
        # Uncomment to enable naxsi on this location
        # include /etc/nginx/naxsi.rules
    }

    location /doc/ {
        alias /usr/share/doc/;
        autoindex on;
        allow 127.0.0.1;
        deny all;
    }

    # Only for nginx-naxsi : process denied requests
    #location /RequestDenied {
        # For example, return an error code
        #return 418;
    #}

    #error_page 404 /404.html;

    # redirect server error pages to the static page /50x.html
    #
    #error_page 500 502 503 504 /50x.html;
    #location = /50x.html {
    #   root /usr/share/nginx/www;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini

        # With php5-cgi alone:
        fastcgi_pass 127.0.0.1:9000;
        # With php5-fpm:
        fastcgi_index index.php;
        include fastcgi_params;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
        deny all;
    }

    error_page 500 /errors/6.php;
    error_page 404 /errors/4.php;
    error_page 403 /errors/2.php;

    if (!-e $request_filename){
        rewrite ^/user\/([^/]+)\/?([a-zA-Z]*)? /profile.php?username=$1&tab=$2 last;
    }
    if (!-e $request_filename){
        rewrite ^/messages\/([^/]+)\/? /messages.php?chat=$1 last;
    }
    if (!-e $request_filename){
        rewrite ^/interests\/([^/]+)\/? /interests.php?interest=$1 last;
    }

    if (!-e $request_filename){
        rewrite ^/(.*?)/?$ /$1.php last;
    }
}

更新: session_start() が原因になることはありますか? 起動時にハングすると思いますか?

4

1 に答える 1

0

解決しました。どうやら、関数 getWorkstamp() が問題を引き起こし、無限ループが発生していたようです。

于 2014-06-30T07:54:39.933 に答える