How do I get nginx to serve the "www." version of

  • Posted October 27, 2014

Hello everyone,

I downloaded a LEMP stack onto my server and I have gotten nginx to serve, but for the life of me I cannot figure out how to get nginx to serve

Here is what the code looks like currently:

server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        root /usr/share/nginx/html;
        index index.php index.html index.htm;


        location / {
                try_files $uri $uri/ =404;

What change can I make to get to work?


Thank you for the help cherwin, appreciate it. I added an A record for

This comment has been deleted

Edit: extra information that was not needed

You did not setup DNS correctly. The A record is missing for

Do you get the correct IP when you try to resolve If so, did you change your nginx config and forgot to reload it? Do you have something in /etc/hosts pointing to Furthermore, why do you try to hide the domain name? It doesn’t make it easier to troubleshoot for us if you do not even tell us what your domain name really is.

I am not sure. Here is all that I know:

The domain name is signed up with Hover and the Name servers are ns1 to

The DNS settings for the domain name are on their default settings.

On the DigitalOcean side, I have signed up with ns1 to

There is an “A” record for The line is A @ “ip of server”.

Seems legit. Did you configure DNS correctly? You’re not giving enough information to go on.

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

You did not setup DNS correctly. Fix the A record for

This comment has been deleted