Nginx Server Block Not Working? - Already running other vhosts just this one not working

Posted by daveaspinall on Server Fault See other posts from Server Fault or by daveaspinall
Published on 2012-04-13T09:12:18Z Indexed on 2012/04/16 11:32 UTC
Read the original article Hit count: 232

Filed under:
|
|

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

© Server Fault or respective owner

Related posts about linux

Related posts about nginx