首页 文章

Nginx说“502 Bad Gateway”

提问于
浏览
2

好的,我在本地运行一个应用程序为homestead.app:8000 . 我正在运行Vagrant,这只是在我做了“vagrant halt”来改变Nginx的文档根然后流浪之后才开始发生的 .

Nginx返回502 Bad Gateway到浏览器,我的测试域的错误日志说明如下:

*2014/05/18 21:37:11 [crit] 1368#0: 7 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.0.2.2, server: homestead.app, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "homestead.app:8000"

1 回答

  • 1

    确保php-fpm正在运行 . 我有类似的问题,所以最后我将默认的php-fpm端口从9000更改为8999并从nginx.conf文件中取出套接字信息(替换为主机和端口号) . 就我而言,这是有效的:

    location ~ \.php {
            fastcgi_pass 127.0.0.1:8999;
            fastcgi_index /index.php;
    
            include /usr/local/etc/nginx/fastcgi_params;
    
            fastcgi_split_path_info       ^(.+\.php)(/.+)$;
            fastcgi_param PATH_INFO       $fastcgi_path_info;
            fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_read_timeout 600;
        }
    

相关问题