Nginx conf file resets to defualt everyday

Abraham93

Registered
Oct 14, 2022
3
0
1
México
cPanel Access Level
Root Administrator
Hello everyone, Hope you can help me.

I recently installed Nginx Manager in my VPS with cPanel due application requeriments. Since then, everytime I change my /etc/nginx/conf.d/users/domain.conf file it restarts once a day to default configuration.

This is causing me a lot of troubles because I happens at night so my application breaks down.


I've used nginx before but this is my very first time that I use with cPanel so I'm not feel safe to change files.


Thank you for your help.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
13,259
2,086
363
cPanel Access Level
Root Administrator
Hey there! This is normal behavior as you aren't able to directly edit the configuration files on a cPanel system. You'll want to check the "Custom Configurations" section in our documentation here:


as that will explain how you can modify the configuration so it's not overwritten.
 

Abraham93

Registered
Oct 14, 2022
3
0
1
México
cPanel Access Level
Root Administrator
I have done what it says on "User Configuration" created a /etc/nginx/conf.d/users/username/domainname/domain.conf added my nginx configuration
and then I got this error:
nginx: [emerg] "server" directive is not allowed here in /etc/nginx/conf.d/users/username/domainname/domain.conf:1

Then I tried on /etc/nginx/conf.d/server-includes/domain.conf and got same error.

(I have 2 domains in my vps) Then I realized that somehow one of my domains, domainA.conf its empty but domainB.conf (the one I'm using and editting everyday after it resets) has a nginx default config, even I deleted and made my "User Configuration" and updated the server it automatically creates again domainB.conf with nginx default config. How can I stop this just like my domainA.conf that keeps empty.

After all this I realized again that my domainB.conf has a "include" so on my "User Confugration" I just kept what I need but then since my domainB.conf has a "location / { ... }" I cannot rewrite and show a duplicate error.
 

caos989

Registered
Nov 4, 2022
3
0
1
Austria
cPanel Access Level
Root Administrator
I want to use Nginx + Varnish Cache for Magento 2.4

I have the same problem like abraham93.

My mainproblem is that Varnish needs port 80 for working.

Is there a solution to deactivate the overwriting of listen ports in /etc/nginx/conf.d/users/user.conf ?
 

caos989

Registered
Nov 4, 2022
3
0
1
Austria
cPanel Access Level
Root Administrator
@caos989 - there is not a supported way to make that change. Our implementation of Nginx is designed for frontend caching to the Apache service, so it will always attempt to use the next highest port number, which is typically 81 and 444.
81 and 444 for NGINX would be fine. 8080 and 443 even better.

My Apache is running on 8181 and 444 now.

Right now my nginx is getting resettet to Port 80 and 443 everytime so It's blocking Varnish from starting.

Can you tell me where is the file that tell my user.conf file to change the Port to 80?