Question

Nginix showing on homepage after setting up domain

Posted August 8, 2020 100 views
Nginx

I followed this tutorial to set up my application.

Everything was working fine when I had my IP address as the server name but now that I’ve changed the server name to my domain I’m seeing the following when I visit my domain:

“Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.”

server {
    listen 80;
    server_name programaticlearning.com;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/stephen/blog;
    }
    location /media/ {
        root /home/stephen/blog;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/home/stephen/blog.sock;
    }
}

What could be going wrong here? From the tutorial there is a section mentioning trouble shooting nginx and that setting up the server name is the main cause of this issue. However I’ve already set up the server name with my domain name.

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.

×
1 answer

Hi @stephenlang91,

I can see you’ve configued both /media and /static to go to te same folder. Can I ask if there is a specific reason behind this? Usually, your configuration file should look like this :

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

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

        server_name _;

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

Can you try seting up your configuration file like so.

Please remember to change the line

root /var/www/html

with your actual path to your website so it looks like

root /path/to/website

Additionally, where it says

server_name _;

change it to match your domain name, like so

server_name example.com;

Where example.com is your domain.

Regards,
KFSys

Submit an Answer