Server Block not Working, it Goes to the Default Server Block

May 26, 2015 1.4k views
DNS Nginx Ubuntu


I'm currently trying to add a Server Block for one of my domains but for some reason it's not working, it goes to the default block when viewed on a browser, this is what I did.

  1. Pointed my domain to the name server from Digitalocean.

  2. Added the domain under the DNS menu in Digitalocean

  3. Created a folder for my site in the /var/www folder.

  4. Created an index.html file inside the mysitename folder.

  5. Created the server block file.

*mysitename.com block content: *

server {
listen 80;
listen [::]:80;

root /var/www/mysitename;
index index.html index.htm;

server_name mysitename.com www.mysitename.com;

location / {
    try_files $uri $uri/ =404;
  1. Enabled the server block. sudo ln -s /etc/nginx/sites-available/mysitename.com /etc/nginx/sites-enabled/

As you can see this is not set to be the default block but when I type mysitename.com it show the content from the block I have set as the default block.

Any idea what am I missing?


1 Answer

This question was answered by @ryanpq:

After enabling the server block did you restart your nginx server so it picked up the new configuration?

service nginx restart

View the original comment

Have another answer? Share your knowledge.