简体   繁体   English

nginx:502错误:connect()失败(111:连接被拒绝),带有游民

[英]nginx: 502 error: connect() failed (111: Connection refused) with vagrant

I'm experiencing 502 gateway errors when accessing my site on 127.0.0.1:8000 Working with Vagrant and ubuntu with nginx, trying to install Magento 2.0. 在127.0.0.1:8000上访问我的网站时,我遇到502网关错误,尝试通过Nginx使用Vagrant和ubuntu,尝试安装Magento 2.0。 After a lot of bugfixxing I still have this 502 error. 经过大量的错误修正后,我仍然遇到此502错误。

Config: 配置:

  • Ubuntu 14.04 (ubuntu/trusty64 box) Ubuntu 14.04(ubuntu / trusty64盒子)
  • Php 5.6.18 from ppa 来自PPA的PHP 5.6.18
  • Nginx 1.8.1 Nginx 1.8.1

Error log: 错误日志:

connect() failed (111: Connection refused) while connecting to upstream, client: 10.0.2.2, server: localhost, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:7777", host: "127.0.0.1:8000", referrer: "http://127.0.0.1:8000/"

VagrantFile config: http://pastebin.com/rMSTmwJn VagrantFile配置: http ://pastebin.com/rMSTmwJn

my /etc/php5/pool.d/vagrant.conf (and www.conf) file: http://pastebin.com/hHnFrf55 我的/etc/php5/pool.d/vagrant.conf(和www.conf)文件: http : //pastebin.com/hHnFrf55

my /etc/nginx/sites-available/default file: http://pastebin.com/0mwR7CxY 我的/ etc / nginx / sites-available /默认文件: http : //pastebin.com/0mwR7CxY

which includes this magento nginx config file: https://github.com/magento/magento2/blob/develop/nginx.conf.sample (no edits) 其中包含此magento nginx配置文件: https : //github.com/magento/magento2/blob/develop/nginx.conf.sample (无编辑)

Also have I edited the user and group in www.conf to 'vagrant' 我也将www.conf中的用户和组编辑为'vagrant'

I'm really stuck on this one. 我真的很坚持这一点。 Hope you guys can help! 希望你们能提供帮助! If you need more information, please let me know. 如果您需要更多信息,请告诉我。

I think the problem is occur in your nginx config. 我认为问题出在您的Nginx配置中。 It only serves your localhost, but you are trying to access from physical, or another virtual machine. 它仅为您的本地主机提供服务,但您正在尝试从物理或其他虚拟机进行访问。 Try to add public domain name. 尝试添加公共域名。 also add 10.0.2.2 public.domain to client's /etc/hosts file. 还将10.0.2.2 public.domain添加到客户端的/ etc / hosts文件中。 And change below config's related line as server_name localhost public.domain; 并在配置的相关行下面更改为server_name localhost public.domain;

server {
    listen 80;
    server_name localhost public.domain;

    set $MAGE_ROOT /var/www/magento2;
    set $MAGE_MODE developer;

    include /vagrant/magento2/nginx.conf.sample;
}

After some more struggling I found out with php5-fpm -t and nginx -t I had an error in my /etc/php5/pool.d/vagrant.conf file rule 1 (:1). 经过更多的努力后,我发现php5-fpm -tnginx -t/etc/php5/pool.d/vagrant.conf文件规则1(:1)中出错。 I change vagrant to [vagrant] . 我将vagrant更改为[vagrant]

Next I got the following error from php5-fpm -t : Both www.conf and vagrant.conf serve on port :7777. 接下来,我从php5-fpm -t收到以下错误:www.conf和vagrant.conf都在端口:7777上服务。 Makes sense, so I changed www.conf to listen :9000 and everything is working! 有道理,所以我将www.conf更改为监听:9000,一切正常! Thanks for the effort. 感谢您的努力。

These answers got me close, but weren't my exact problem. 这些答案使我接近,但不是我的确切问题。

For those interested I'm using Windows 10 with Vagrant - 1.9.3 (laravel/homestead) box. 对于那些感兴趣的人,我将Windows 10与Vagrant-1.9.3(laravel / homestead)结合使用。

I was using this in my nginx config: 我在我的nginx配置中使用了这个:

fastcgi_pass 127.0.0.1:9000;

I recently changed it to this: 我最近将其更改为:

fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 502 Bad Gateway: nginx, php5-fpm, 175/209 connect() 连接到上游时失败(111:连接被拒绝) - 502 Bad Gateway: nginx, php5-fpm, 175/209 connect() failed (111: Connection refused) while connecting to upstream nginx:连接到上游时连接()失败(111:连接被拒绝) - nginx: connect() failed (111: Connection refused) while connecting to upstream Raspbian owncloud nginx [错误] 2667#0:* 4连接到上游时connect()失败(111:连接被拒绝) - Raspbian owncloud nginx [error] 2667#0: *4 connect() failed (111: Connection refused) while connecting to upstream SMTP错误:无法连接到服务器:连接被拒绝(111)错误消息 - SMTP ERROR: Failed to connect to server: Connection refused (111) ERROR MESSAGE SMTP->错误:无法连接到服务器:与zoho邮件的连接被拒绝(111) - SMTP -> ERROR: Failed to connect to server: Connection refused (111) with zoho mail SMTP错误:无法连接到服务器:Godaddy服务器上的连接被拒绝(111) - SMTP ERROR: Failed to connect to server: Connection refused (111) on Godaddy server Gmail帐户SMTP->错误:无法连接到服务器:连接被拒绝(111) - Gmail Account SMTP -> ERROR: Failed to connect to server: Connection refused (111) SMTP - >错误:无法连接到服务器:连接被拒绝(111) - SMTP -> ERROR: Failed to connect to server: Connection refused (111) nginx:连接到上游时连接()失败(111:连接被拒绝) - 更新后 nginx - - nginx: connect() failed (111: Connection refused) while connecting to upstream - after update nginx - SMTP错误:无法连接到服务器:使用Office365拒绝连接(111) - SMTP ERROR: Failed to connect to server: Connection refused (111) with Office365
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM