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.
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.
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
I did restart the service after every change I made.
The last change I made was to remove [ default_server ipv6only=on ] in the listen property in the server 2 file. So I'm assuming this was my problem.
Block one:
server {
listen 80;
listen [::]:80 default_server ipv6only=on;
Block two:
server {
listen 80;
listen [::]:80;
I appreciate your response, thanks.
remove [ defaultserver ipv6only=on ] in the listen property in the server 2 file. Only one block should be designated as defaultserver.
Correct configuration:
Block one:
server {
listen 80;
listen [::]:80 default_server ipv6only=on;
Block two:
server {
listen 80;
listen [::]:80;
I have the same question; I have multiple domains redirecting to the same nginx server, but my PHP code handles each site differently.
When I have set up the one domain to point at my servers IP, I simply see the old site.
Any solutions on this? Is it simply to remove ipv6only=on?
I have server with IP I dont have domain name I want to host two seporate appliaction. I need Help.
Consider putting in your ip address into a service like http://xip.io. It just takes an ip address and will give you infinite sub domains under that one ip address. Setup your server blocks to catch the xip io server names.
So 192.168.1.1 (an example, with a Class C address) Would become Project1.192.168.1.1.xip.io And Project2.192.168.1.1.xip.io. You could do this on and on. It works great for quick fixes and testing applications until your ready to go forward with a real deal domain purchase.
Paste your Vhost(s) from nginx.
I have two files:
One:
Two: