Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Re: nginx second site configuration

$
0
0
VonHerman, Thank you very much for the tip. I did some play around after I read the link that you posted and I got it to work when I repeated the same config instructions from the one that was working. On the second one I also included the PHP fast cgi instructions which I believe is what made it work since these are both Wordpress sites. But I am aware that this is not the correct way to do since a single config file for all sites can be difficult to read and be unmanageable as it grows.

So I tried splitting the code for these 2 domains like this:
1. Under sites-available I created only one server section for each file and named them as domain1 and domain2
2. I enabled the sites using the ln -s /etc/nginx/sites-available/domain1 /etc/nginx/sites-enabled/domain1 and I enabled the sites using the ln -s /etc/nginx/sites-available/domain2 /etc/nginx/sites-enabled/domain2
3. Then I restarted nginx using sudo service nginx restart

But, unfortunately this approach did not work because now all requests are going to domain1. I don't know why is doing that?
I am not sure if nginx picks it as the default.

PS: I don't have the default attribute set under server_name. It sounds like it picks just one of the files an it is really weird that the second domain requests are going to the first one. According to that link that you gave the nginx should match the server_name exact name.

Thank you

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>