Report this

What is the reason for this report?

Problem with nginx configuration - second approach

Posted on April 25, 2020

Hello, I was trying to deal with my problem which I wrote here: https://www.digitalocean.com/community/questions/problem-with-configure-nginx-i-guess-to-cooperate-with-domain-and-not-show-ip-address

Now I have that case:

  • When I put server_name domain.com www.domain.com in nginx configuration file, I see only nginx start page but with my domain name: Image 1

  • When I put server_name domain.com www.domain.com ip_address in nginx configuration file, I see my webpage but with ip_address: Image 2

I think I’ve been trying everything and did everything in all guidelines. Here is my actual nginx content:

server {
    listen 80;
    server_name mydomain.com www.mydomain.com ip_address;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/tuliokkj/my_project;
    }

    location /media/ {
        root /home/tuliokkj/my_project;
    }


location / {
        include proxy_params;
#        proxy_set_header Host karolkurek.pl;  # I tried with this line and without it
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://unix:/home/tuliokkj/my_project/portfolio.sock;
    }

}

Any ideas?



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!

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.

Hello,

What you could do is delete the default Nginx server block so that it does not cause such issues for you.

That way you would know that you only have 1 active server block and you would not see the Nginx welcome page.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.