nginx / 1.4.6中的502 Bad Gateway(Ubuntu14数字海洋)

时间:2017-01-26 03:57:37

标签: nginx

我安装PHP7.0,Nginx1.4.6并配置如下,但我遇到了很多错误。

sudo nano /etc/php/7.0/fpm/pool.d/www.conf

#listen = /run/php/php7.0-fpm.sock
#listen = /var/run/php/php7.0-fpm.sock
listen = 127.0.0.1:9000
user = www-data
group = www-data
listen.owner = www-data
listen.group = www-data
listen.mode = 0660

server {
#       listen 80 default_server;
        listen 80;
        listen [::]:80 default_server ipv6only=on;

        location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        #fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        fastcgi_pass 127.0.0.1:9000;
        #fastcgi_index index.php;
        #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

让我们看一下Log:

2017/01/26 03:33:54 [error] 2976#0: *8 connect() failed (111: Connection refused) while connecting to upstream, client: 96.9.77.42, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "128.199.133.1$
2017/01/26 03:33:55 [error] 2976#0: *8 connect() failed (111: Connection refused) while connecting to upstream, client: 96.9.77.42, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "128.199.133.1$
2017/01/26 03:33:55 [error] 2976#0: *8 connect() failed (111: Connection refused) while connecting to upstream, client: 96.9.77.42, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "128.199.133.1$

1 个答案:

答案 0 :(得分:1)

您可能需要将<div class="main-btn" onClick="document.forms['general-contact'].submit()"> <span>Submit</span> </div> 设置为listen.allowed_clients&amp;评论127.0.0.1&amp; group个部分

user

然后重启php-fpm服务,检查它是否在端口# only localhost can connect to PHP-FPM listen = 127.0.0.1:9000 listen.allowed_clients = 127.0.0.1 # listen.owner = www-data # listen.group = www-data 上运行