2

我刚刚在我的网站上设置了 nginx,当访问者访问 php-cgi.exe 并且网站变得非常缓慢时,我不确定它是否正在加载。从我所见,nginx.exe 仍然作为服务运行。下面是我的错误日志(每次都是相同类型的消息),我认为它们与 ajax 调用有关,我对它为什么这样做以及如何修复它感到非常困惑。

错误:

    2015/09/27 09:42:58 [error] 800#3404: *334 WSASend() failed (10054: An existing connection was forcibly closed by the remote host) while sending request to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443372147307 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/27 09:42:58 [error] 800#3404: *311 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443372147305 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/27 09:42:58 [error] 800#3404: *305 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443372147304 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/27 09:42:58 [error] 800#3404: *310 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443372147306 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/27 09:42:58 [error] 800#3404: *324 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443372147303 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"

php-cgi.exe 关闭后,我开始收到这些错误

2015/09/27 09:43:58 [error] 800#3404: *323 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443372147308 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
    2015/09/27 09:43:58 [error] 800#3404: *334 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443372147309 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
    2015/09/27 09:43:58 [error] 800#3404: *324 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443372147310 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
    2015/09/27 09:43:58 [error] 800#3404: *305 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443372147311 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
    2015/09/27 09:43:58 [error] 800#3404: *311 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443372147312 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
    2015/09/27 09:43:58 [error] 800#3404: *310 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443372147313 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"

停止和启动 nginx 再修复 5 分钟,直到进行大约 15 次 ajax 调用,直到它再次崩溃!!?每 1 秒调用一次 ajax 调用来更新聊天框

阿贾克斯:

function loadMessages()
{
    $.ajax({

     type: "GET",
     url: '<?php echo $config['website']['url']; ?>/assets/hk/ajax/staff_messages.php',
     success: function(data) {

          if (staffContent != data)
          {
              var div = document.getElementById('staffmessagesArea');
          div.innerHTML = data;
          staffContent = data;
          updateScroll();
          }
     }

   });
    setTimeout(loadMessages,1000);
}

Ajax 调用页面:

<?php
require_once '../../other/connection.php';
global $pdo;

$stmt = $pdo->prepare("SELECT * FROM `craft_hk_messages` ORDER BY `When`");
$stmt->execute();
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach ($rows as $row) 
{
    if ($row['Sender'] == $_SESSION['user']['username'])
    { 
        echo '<div class="col-md-12"><div style="height:40px;background-color:#B5B5B5;padding:14px;padding-top:10px;border-radius:4px;color:white;float:right;margin-bottom:20px;">' . $row['Message'] . '</div><br></div>';
    }
    else
    {
        $figure = "https://game.boon.pw/habbo-imaging/avatarimage.php?figure=".$_SESSION['user']['look']."&action=wav&direction=2&head_direction=3&gesture=sml&size=m&headonly=1";
        echo '<div class="col-md-2" style="min-height:50px !important;
        background-image:url(\''; echo $figure . '\');background-size: 50px 50px;background-repeat:no-repeat;">
        </div><div class="col-md-10" style="margin-left:-60px;"><div style="border-radius:4px;height:40px;background-color:#0094FF;padding:14px;padding-top:10px;color:white;width: auto;float:left;
        margin-bottom:20px;

    position: relative;">'.$row['Sender'].': ' . $row['Message'] . '</div></div>';
    }
}
?>
</thead>
<tbody>
</tbody>
</table>

Nginx 配置:

worker_processes  4;  # 2 * Number of CPUs

events {
    worker_connections  19000;  # It's the key to high performance - have a lot of connections available
}

worker_rlimit_nofile    20000;  # Each connection needs a filehandle (or 2 if you are proxying)


# Total amount of users you can serve = worker_processes * worker_connections


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  15;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;



        location / {
            rewrite ^/(|/)$ /index.php?page=$1;
            rewrite ^/([a-zA-Z0-9_-]+)(|/)$ /index.php?page=$1;
            rewrite ^/(.*).htm$ /$1.php;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /404.php
        #
        error_page   500 502 503 504  /404.php;
        location = /404.php {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ .php$ {
    root           html;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_read_timeout 60000s;
    fastcgi_param  SCRIPT_FILENAME  C:/nginx/html/$fastcgi_script_name;
    include        fastcgi_params;
    }

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


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

即使 php-cgi 关闭,ajax 调用也会继续进行,但您无法重新加载,因为网站将显示为离线。

edit4 日志更新:

2015/09/28 11:40:27 [emerg] 2280#948: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a way forbidden by its access permissions)
2015/09/28 11:43:46 [error] 2612#2276: *4 CreateFile() "C:\nginx/html/index" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /index HTTP/1.1", host: "158.69.21.193"
2015/09/28 11:43:46 [error] 2612#2276: *4 CreateFile() "C:\nginx/html/favicon.ico" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "158.69.21.193", referrer: "http://158.69.21.193/index"
2015/09/28 11:43:53 [error] 2612#2276: *4 CreateFile() "C:\nginx/html/starter-template.css" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /starter-template.css HTTP/1.1", host: "158.69.21.193", referrer: "http://158.69.21.193/index.php?page=index"
2015/09/28 11:45:10 [error] 1712#2324: *1 CreateFile() "C:\nginx/html/starter-template.css" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /starter-template.css HTTP/1.1", host: "158.69.21.193", referrer: "http://158.69.21.193/index"
2015/09/28 11:45:21 [error] 1712#2324: *1 CreateFile() "C:\nginx/html/assets/website/images/bg_hotel.out.png" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/website/images/bg_hotel.out.png HTTP/1.1", host: "158.69.21.193", referrer: "http://158.69.21.193/home"
2015/09/28 11:45:36 [error] 1712#2324: *2 CreateFile() "C:\nginx/html/assets/website/images/bg_hotel.out.png" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/website/images/bg_hotel.out.png HTTP/1.1", host: "158.69.21.193", referrer: "http://158.69.21.193/account"
2015/09/28 11:46:22 [error] 1712#2324: *1 CreateFile() "C:\nginx/html/hk/index" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /hk/index HTTP/1.1", host: "158.69.21.193"
2015/09/28 11:47:08 [error] 1712#2324: *16 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991116 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:47:08 [error] 1712#2324: *16 CreateFile() "C:\nginx/html/50x.html" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991116 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:47:08 [error] 1712#2324: *39 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443465991119 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:47:08 [error] 1712#2324: *39 CreateFile() "C:\nginx/html/50x.html" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443465991119 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:47:08 [error] 1712#2324: *1 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443465991117 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:47:08 [error] 1712#2324: *1 CreateFile() "C:\nginx/html/50x.html" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443465991117 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:47:08 [error] 1712#2324: *27 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991118 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:47:08 [error] 1712#2324: *27 CreateFile() "C:\nginx/html/50x.html" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991118 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:47:08 [error] 1712#2324: *2 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991120 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:47:08 [error] 1712#2324: *2 CreateFile() "C:\nginx/html/50x.html" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991120 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *40 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443465991121 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *40 CreateFile() "C:\nginx/html/50x.html" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443465991121 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *16 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991122 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *16 CreateFile() "C:\nginx/html/50x.html" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991122 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *39 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443465991123 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *39 CreateFile() "C:\nginx/html/50x.html" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443465991123 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *517 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991124 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *517 CreateFile() "C:\nginx/html/50x.html" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991124 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *27 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443465991125 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *27 CreateFile() "C:\nginx/html/50x.html" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443465991125 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *2 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991126 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *2 CreateFile() "C:\nginx/html/50x.html" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991126 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
4

0 回答 0