nginx - I configure lnmp on docker on Alibaba Cloud and use their load balancing, but PHP keeps reporting errors?
大家讲道理
大家讲道理 2017-05-16 13:08:22
0
2
1021

1. This is the log of the nginx container

cnp_nginx_1 | 2017-04-24T03:39:25.712515392Z 172.19.0.2 - - [24/Apr/2017:03:39:25 +0000] "GET /favicon.ico HTTP/1.1" 502 537 "http://test.h5m3.com/info.php" "Mozilla/5.0 (Macintosh; Intel Mac OS "
cnp_nginx_1 | 2017-04-24T03:39:25.712580045Z 2017/04/24 03:39:25 [error] 5#5: *17 upstream sent unsupported FastCGI protocol version: 72 while reading response header from upstream, client: 172.19. 0.2, server: test.h5m3.com, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://172.19.0.2:80", host: "test.h5m3.com", referrer: " http://test.h5m3.com/info.php"

The error shown is that fastCGI cannot be supported

2. This is the log of my php container

cnp_php_3 | 2017-04-21T08:56:14.000414408Z [21-Apr-2017 08:56:14] NOTICE: fpm is running, pid 1
cnp_php_3 | 2017-04-21T08:56:14.003017711Z [21-Apr-2017 08:56:14] NOTICE: ready to handle connections
cnp_php_1 | 2017-04-21T08:56:17.849914483Z [21-Apr-2017 08:56:17] NOTICE: fpm is running, pid 1
cnp_php_1 | 2017-04-21T08:56:17.850479606Z [21-Apr-2017 08:56:17] NOTICE: ready to handle connections
cnp_php_2 | 2017-04-21T08:56:15.971419535Z [21-Apr-2017 08:56:15] NOTICE: fpm is running, pid 1
cnp_php_2 | 2017-04-21T08:56:15.973517887Z [21-Apr-2017 08:56:15] NOTICE: ready to handle connections

3. This is my nginx configuration

 server {
    listen 80;
    server_name test.h5m3.com;
    root /usr/share/nginx/html;
       
    #charset koi8-r;
    #access_log /var/log/nginx/log/host.access.log main;
                                                                                                                                                                                    
    location/{
        root /usr/share/nginx/html;
        index index.html index.htm index.php;
      if (!-e $request_filename) {
       rewrite ^/index.php(.*)$ /index.php?s=$1 last;
       rewrite ^(.*)$ /index.php?s=$1 last;
       break;
       }
    }
                                                                                                                                                                                    
    #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/html;
    }

                                                                                                                                                                                    
    location ~ \.php$ {
        #try_files $uri =404;
        fastcgi_pass php.local:80;
        fastcgi_param HTTP_HOST php.local;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
        include fastcgi_params;
    }

} 
大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(2)
伊谢尔伦

fastcgi_passThere may be something wrong with the subsequent configuration. The port of php should not be 80. The port of php-fpm is 9000

巴扎黑

Configure FastCGI and try again
http://www.server110.com/ngin...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template