NginX&Plesk:502

有CentOS和Plesk服务器。 安装nginx的权利如何描述在这里: http : //gudym.net/plesk-nginx.html但现在,如果我去mysupermegasite.com我越来越

502 Bad Gateway nginx/0.8.55 

这个错误似乎是因为Apache不响应NginX。 但如果我去mysupermegasite.com:8080我看到正确的页面。 所以Apache似乎在8080端口运行良好。 而在这个指示Apache应该是在8080! 所以这似乎是正确的。

也在

/var/www/vhosts/mysupermegasite.com/conf/nginx.conf我看到:

  server { listen 80; server_name mysupermegasite.com www.mysupermegasite.com ; error_log /var/www/vhosts/mysupermegasite.com/statistics/logs/error_log.nginx warn; location / { proxy_pass http://www.mysupermegasite.com:8080$request_uri; include /etc/nginx/proxy.conf; } location ~*/w3tc/* { proxy_pass http://www.mysupermegasite.com:8080$request_uri; include /etc/nginx/proxy.conf; } location ~* ^.+\.(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|bmp|rtf|js|ico|swf)$ { root /var/www/vhosts/mysupermegasite.com/public_html; expires 7d; } } 

所以…据我所知,它指示nginx到mysupermegasite.com:8080从Apache获取页面。

让我们看看错误日志vi /var/www/vhosts/mysupermegasite.com/statistics/logs/error_log.nginx

2012-02-07 07:35:29 [error] 11758#0:* 1 mysupermegasite.com无法解决(110:操作超时),客户端:89.112.11.xx,服务器:mysupermegasite.com,请求: “GET / HTTP / 1.1”,主机:“mysupermegasite.com”

好吧,它无法parsing这个域名。 买为什么? 我甚至补充说

 127.0.0.1 mysupermegasite.com 

/ etc / hosts文件

如果我尝试

 wget mysupermegasite.com:8080 

它下载页面。 但为什么NginX无法解决这个主机?

怎么了? 在哪里寻找原因?

似乎你的系统无法parsing这个域名。 nginx不使用/etc/hosts文件来parsing域。 检查/etc/resolv.conf包含正确的名称服务器。 我build议你明确指定IP地址或localhost

 location / { proxy_pass http://localhost:8080; } 

或者你可以为nginx指定更好的parsing器,它知道这个域,而不是来自/etc/resolv.conf的parsing器:

 resolver 192.0.2.1; 

你可以检查parsing器是否知道域名:

 # dig mysupermegasite.com @192.0.2.1