![]() |
|
Nginx Multiple Sites Issue - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Webmasters (https://hackforums.net/forumdisplay.php?fid=141) +---- Forum: Website Construction (https://hackforums.net/forumdisplay.php?fid=50) +---- Thread: Nginx Multiple Sites Issue (/showthread.php?tid=5597899) |
Nginx Multiple Sites Issue - Dale Carnegie - Apr 12, 2017 So currently I have nginx on my VPS setup for hosting a couple websites of mine. One site is hosted/connecting just fine however it is using site files not in teh directory I specified. For example: Code server {^ I have it setup so that the site files will come from domain1.com folder; however, when connecting to the site it just uses all files found in the root html directory. :/ hmmm... Non the less atleast the site is working and is hosted. But when I tried setting up my server to run a second domain I used essentially the same exact config accept for obviously I changed the domain. And yes I've already put this in the nginx config file Code include /etc/nginx/sites-enabled/*.conf;Also made sure to enable both of the sites with this command Code sudo ln -s /etc/nginx/sites-available/domain1.com /etc/nginx/sites-enabled/All of this my second domain forwarded correctly yet it will not connect to the server... Any suggestions?? Assistance is greatly appreciated 🤝 * - Computer Craft - Apr 12, 2017 Helped him setup Nginx properly and fixed some minor DNS issues. If you ever need anymore help, feel free to shoot me a PM or message me on Discord. * - Computer Craft - Apr 13, 2017 (Apr 13, 2017 01:12 AM)Yani Wrote: What was the issue? Oh yeah, no problem. The main issue that caused his problems were only having the subdomain of www. pointing to his domain and a few Nginx settings that needed to be changed. Under server_name in the Nginx sites-available, he only had the domain listed when he needed to have both the domain and the www. domain listed. Before Code server_name domain1.com;Code server_name domain1.com www.domain1.com;As for DNS, he had WWW pointing to his IP but he didn't have @ pointing to his domain. So you could connect through the subdomain www. domain1 but not connect directly to the website. This lead to Nginx pointing the direct connection to the website to the default directory of his website folder, not the sub folder for the specific domain. After all of that, we then only needed to change two lines in his Nginx.conf that were incorrect. Before Code #server_names_hash_bucket_size 64;Code server_names_hash_bucket_size 64;After that I helped show him some better practices when using Nginx and helped clear up some confusion. Sorry about not posting the solution earlier, I don't know what I was thinking. 😝 * - ItsOffshore - Jul 21, 2017 If you still need help with this, please PM me. |