Question

my www.domain.com goes to Nginx welcome page

Hello my https://domain.com is working fine but my www.domain.com is redirected to Welcome to nginx! page. I’m using ubuntu 20.04.


Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Hi @amirShark,

This means you haven’t configured your www domain in your Nginx config. In your Nginx domain config you’ll need to add the www part as well.

sudo nano /etc/nginx/sites-available/your_domain

The config would look something like:

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

        root /var/www/your_domain/html;
        index index.html index.htm index.nginx-debian.html;

        server_name your_domain.com www.your_domain;

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

Find the server_name directive and include www.your_domain on the line.

Hi @amirShark,

I think you have some configuration problem on your nginx virtualhost.

Take a look at https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04, explain how to correctly create the server blocks in nginx.

Hope helps you, Sergio Turpín