Having server with CentOS and Plesk. Installed nginx right how it's discribed here: http://gudym.net/plesk-nginx.html But now if i go to mysupermegasite.com I'm getting

502 Bad Gateway

This error seems to be because Apache doesn't respond to NginX. BUT if I get to mysupermegasite.com:8080 i see the correct page. So Apache seems to run fine at 8080-th port. And in that instruction Apache supposed to be at 8080-th! So this seems to be correct.

Also in

/var/www/vhosts/mysupermegasite.com/conf/nginx.conf I see:

  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;

So... as I understand this, it directs nginx to mysupermegasite.com:8080 to get the page from Apache.

Let's see the error log vi /var/www/vhosts/mysupermegasite.com/statistics/logs/error_log.nginx

2012/02/07 07:35:29 [error] 11758#0: *1 mysupermegasite.com could not be resolved (110: Operation timed out), client: 89.112.11.xx, server: mysupermegasite.com, request: "GET / HTTP/1.1", host: "mysupermegasite.com"

Okay, it can't resolve this domain. Buy why? I even added mysupermegasite.com

to the /etc/hosts file

If I try

wget mysupermegasite.com:8080

it downloads the page. But why NginX can't resolve this host?

What's wrong? Where to look for the reason?

closed as off-topic by HopelessN00b Feb 25 '15 at 8:53

  • This question does not appear to be about server, networking, or related infrastructure administration within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.


Seems that your system can't resolve this domain. nginx doesn't use /etc/hosts file to resolve domains. Check that /etc/resolv.conf contains correct nameservers. I suggest you to explicitly specify IP address or localhost:

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

Or you can specify better resolver for nginx, that knows this domain, instead of resolvers from /etc/resolv.conf:


You can check if resolver knows the domain:

# dig mysupermegasite.com @

Not the answer you're looking for? Browse other questions tagged or ask your own question.