Question

Problem with nginx configuration - second approach

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?


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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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.