I have a site working on the root and www domain, e.g. example.com and www.example.com

I'm trying to add a new site under the subdomain t.example.com. When I visit this subdomain in a browser it just hangs for several seconds then times out.

My sites-available directory:

cd /etc/nginx/sites-available
ls -l
-rw-r--r-- 1 root root 2074 dateredacted default
-rw-r--r-- 1 root root 2092 dateredacted example.com
-rw-r--r-- 1 root root 1524 dateredacted t.example.com

My sites-enabled directory showing the symlinks:

cd /etc/nginx/sites-enabled
ls -l
lrwxrwxrwx 1 root root 52 dateredacted example.com -> /etc/nginx/sites-available/example.com
lrwxrwxrwx 1 root root 54 dateredacted t.example.com -> /etc/nginx/sites-available/t.example.com

I verified the DNS is setup correctly by running ping t.example.com which shows me the correct server IP.

Server block:

vi /etc/nginx/sites-available/t.example.com

server {
        listen 80;

        server_name t.example.com;

        root /var/www/vhosts/t.example.com/httpdocs;

        access_log /var/www/vhosts/t.example.com/logs/access.log;
        error_log /var/www/vhosts/t.example.com/logs/error.log;

        index index.html;

I have an index.html file present:

cat /var/www/vhosts/t.example.com/httpdocs/index.html

Permissions and ownership are fine:

cd /var/www/vhosts/
chown -Rf www-data:www-data t.example.com
chmod -Rf 755 t.example.com

Config test and restart is fine:

nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
systemctl restart nginx

I've verified that /etc/nginx/sites-available/t.example.com is being loaded by making a syntax error and then nginx -t which raises the error.

Any ideas why this is hanging when all of the config seems to check out?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.