Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
475 views
in Technique[技术] by (71.8m points)

我在阿里云上docker配置lnmp,使用他们的负载均衡,然后php一直报错?

1.这是nginx容器的日志

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 X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" "117.84.239.30"
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"

显示的错误是不能支持的fastCGI

2.这是我的php容器的日志

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.这是我的nginx的配置

    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;
    }

}  

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

fastcgi_pass后面的配置有问题吧,php的端口不应该80吧,php-fpm的端口是9000


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...