Page 1 of 1

nginx fails to start after adding a web domain

Posted: Thu Feb 08, 2018 5:13 pm
by lukeseven
Hi,

I started experiencing strange issue after adding new domains. I am not sure if upgrading packages or updating VestaCP caused it but all of the sudden it stopped generating nginx.conf and sngingx.conf files automatically as it used to upon adding new web domains in home/user/conf/web folder. Now it only generates example.com.nginx.conf files instead.

Cannot restart the nginx server after new web domain has been added due to this error:

Code: Select all

nginx -t -c /etc/nginx/nginx.conf
nginx: [emerg] open() "/home/user/conf/web/example.com.auth" failed (2: No such file or directory) in /home/user/conf/web/example.com.nginx.conf:43
nginx: configuration file /etc/nginx/nginx.conf test failed

So I have to remove this line

Code: Select all

include /home/user/conf/web/example.com.auth;

from this conf file manually in order to be able start the nginx again

Code: Select all

/home/user/conf/web/example.com.nginx.conf
When I ran apt-get upgrade, I kept all my config files untouched.
I run my VPS on Ubuntu 16.04, latest VestaCP version, nginx version 1.13.8 + ( PHP-FPM 7.0.22 ).
Does anybody know what would be the best approach to fix this issue, please?

Thank you

Re: nginx fails to start after adding a web domain

Posted: Sat Feb 10, 2018 4:34 am
by noogen
lukeseven wrote:
Thu Feb 08, 2018 5:13 pm
I started experiencing strange issue after adding new domains. I am not sure if upgrading packages or updating VestaCP caused it but all of the sudden it stopped generating nginx.conf and sngingx.conf files automatically as it used to upon adding new web domains in home/user/conf/web folder. Now it only generates example.com.nginx.conf files instead.
Yes, this is something new in Vesta v18/recent updates. It now generate separate nginx config file per site instead of a single file. Though don't know what /home/user/conf/web/example.com.auth file is. What php-fpm template are you using? It might be coming from that template.

Re: nginx fails to start after adding a web domain

Posted: Mon Feb 12, 2018 10:25 am
by lukeseven
Thanks for quick respond.

Actually, I use only default templates and I haven't modified it. I am planning to play with the templates in the near future as I gave it try in the past but couldn't get it working the way it should. I was definitely doing something wrong so I stayed with default templates.

However, I left my server untouched during this weekend and when I tried to add Lets's Encrypt cert today, I was finally able to and it successfully assigned the cert but at the end it wasn't propagated anyway. So I just tried to restart nginx again but I couldn't. I looked up the nginx conf file and there was again this line

Code: Select all

include /home/user/conf/web/example.com.auth;
but this time it was added to newly generated example.com.nginx.ssl.conf file. As soon as I removed this line from my nginx conf file, I was able to restart nginx server and the SSL cert now works fine. I don't mind using the newly generated nginx conf file but I need to find what is generating the example.com.auth line in newly added domains nginx conf files and why, and how to fix it.

If we started this kind of discussion about VestaCP nginx conf files, I'd like to ask you something here. How to eliminate the possible nginx service interruptions caused by other admins granted with ssh access to their web domains and its config files. For example: as soon as they make an accidental mistake in their nginx conf files... like for instance: when they just add an incorrect single line to their nginx conf file, they won't be able to restart the nginx server if they try to. But if they don't restart and me as a Super Admin wants to restart it later, it basically won't restart due to an error, which I have search for and fix it. I become quite familiar with nginx log files so I can quickly identify where's the error and fix it but I was just wondering if there is a way to tell the nginx server to restart anyway and keep the other websites running so it only affects the website with the wrong nginx conf file, if you know what I mean? Basically, the nginx server won't start only for the the user with his incorrect setup but it won't affect the user user from running their websites.

I also noticed some random changes in random user's config files and therefore I could't restart the nginx server until I identified and fixed the error in someone's nginx config file. It's too complicated to explain it in detail but it behaves really strange since I have this setup which is about 1 year old. I experienced these kind of strange behavior in the past as well.

I will appreciate any suggestions what will help me to solve this.

Thanks in advance for your insights and help.

Re: nginx fails to start after adding a web domain

Posted: Mon Feb 26, 2018 8:18 pm
by lukeseven
Hi,

thank you for pointing me to the right direction noogen. I kind of refused the fact that it could be a template issue as I haven't touched any of my templates and always used the default ones but something must've gone wrong after updating VestaCP to the latest version.

I found this article here viewtopic.php?f=11&t=15964&p=65986&hilit=vstats#p65986 and I just followed Gordon55M's guide. It just works now.

What else I can say. "VestaCP is just awesome CP!!!"

Cheers

Re: nginx fails to start after adding a web domain

Posted: Tue Apr 19, 2022 3:26 pm
by andrebastos
I had this problem after installing and renewing SSL.

I managed to solve it by removing the code in the template itself.

Now I expect NGINX to restart normally after an SSL install and renewal.

Here is the link to my solution, hope it helps: viewtopic.php?f=11&t=20899#p85916