0

Im running a Debian 6 LEMP server with multiple virtual hosts and everything has been fine for 5 or so sites. But I've just tried adding another but for some reason it's just not working. By not working I mean in Chrome I get the "Oops! Google Chrome could not connect to subdomain.domain.net" error.

I've changed the domain for security to subdomain.example.com and the IP is masked.

Hosts file (I have multiple sub domains):

xxx.xxx.xx.xxx *.example.com *.example

Server Block:

server {
    listen 80;
    server_name     subdomain.example.com;

    access_log      /srv/www/subdomain.example.com/logs/access.log;
    error_log       /srv/www/subdomain.example.com/logs/error.log;
    root            /srv/www/subdomain.example.com/public_html;

    location / {
        index       index.html index.htm index.php;
    }

    location ~ \.php$ {     
        include         fastcgi_params;
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_index   index.php;
        fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    }
}

I've created the system link to the file in the /etc/nginx/sites-enabled/ directory and restarted/reloaded nginx.

DNS seems fine:

# ping -c 2 subdomain
PING subdomain.example.com (xxx.xxx.xx.xxx) 56(84) bytes of data.
64 bytes from www.example.com (xxx.xxx.xx.xxx): icmp_req=1 ttl=64 time=0.035 ms
64 bytes from www.example.com (xxx.xxx.xx.xxx): icmp_req=2 ttl=64 time=0.048 ms

Checking the file with cURL works:

# curl http://subdomain.example.com
HTML - OK

Emptied browser cache but still no dice.

Anything I'm missing? Like I mentioned, I have a few sites running fine on the server currently so php-fpm etc etc are working. Any help would be much appreciated!

Cheers,

Dave

daveaspinall
  • 133
  • 4

2 Answers2

1

its kind of hard to help you out there, as you didn't provide enough information... but I'll try it anyway

  • hosts file doesn't support masking so you can't use "*." in your hosts file.
  • that ping that you did it came from where? server or client?
  • for curl use -v to check your host/IP
  • does your chrome have some sort of proxy enabled? that would possible route you somehow different from what you're expecting..
alexus
  • 13,112
  • 32
  • 117
  • 174
  • hey, thanks for the reply. hmm its odd you mention the hosts file not supporting the *. as I've setup a few sites now using that and they work fine? the ping was from the server but ive traced the domain back to the server using a client also. i'll have a go with the other curl and by hardcoding in the host on Monday though. thanks again for your help, Dave – daveaspinall Apr 13 '12 at 23:29
  • Sorry forgot to mention, is there any other info that would help shine some light on the situation that you can think of? – daveaspinall Apr 13 '12 at 23:29
1

The person who set up the domain for me pointed it to the wrong server IP so that was the issue.

Schoolboy error, sorry to have bothered you all!

On a side note, the *.domain.com references in the hosts file do actually work.

pauska
  • 19,620
  • 5
  • 57
  • 75
daveaspinall
  • 133
  • 4