Question

Multiple sites using nginx

I was able to set up nginx server blocks as per this tutorial. When I try to access the sites through the respective domain names I am directed to the same site. I’m not sure if this is an nginx issue or a dns issue.

Show comments

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.

Hi!

I see different content on each of those domains, so it looks like you got it working! It would be great if you could share what the root cause of your issue was and how you fixed it. That would help others who end up at this question.

Your configuration files look correct. One thing many people forget is that you need to restart Nginx after making any changes:

sudo service nginx restart

remove [ default_server ipv6only=on ] in the listen property in the server 2 file. Only one block should be designated as default_server.

Correct configuration: Block one:

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

Block two:

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

I have server with IP I dont have domain name I want to host two seporate appliaction. I need Help.