nginx1.8 Laravel 502错误的网关错误

时间:2017-02-18 07:52:54

标签: php laravel nginx homestead

解决!

使用Virtualbox设置Homestead vagrantbox 以下是dev.blog.com.conf文件中的服务器配置

    server {
    listen        80;
    server_name   dev.blog.com;
    root          /vagrant/blog/public;
    index         index.php index.html index.htm;

    location / {
      index  index.php index.html index.htm;
      try_files $uri @rewrite;
   }

   location @rewrite {
     rewrite ^ /index.php;
   }

   location ~ \.php$ {
     fastcgi_pass 127.0.0.1:9000;
     fastcgi_index index.php;
     include fastcgi.conf;
   }
   access_log /vagrant/logs/blog.access.log;
   error_log /vagrant/logs/blog.error.log;
   }

在VagrantFile中,我已经取消注释'config.vm.network'这一行

在我的Windows主机文件中,我添加了这一行

 192.168.33.10  dev.blog.com

我一直在重新启动Nginx或刷新页面,但仍然得到了502糟糕的gatway。 关于我的文件夹或其他问题,是否有一些权限问题?

日志

2017/02/17 02:16:54 [error] 1717#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.33.1, server: dev.blog.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.33.10" 
2017/02/17 02:17:02 [error] 1717#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.33.1, server: dev.blog.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.33.10"

1 个答案:

答案 0 :(得分:0)

我想出了问题,新的php配置已被修改了一点,所以在

vim /etc/php5/fpm/pool.d/www.conf

所以听线应该是listen=9000而不是listen = /var/run/php5-fpm.sock