How to make permanent custom proxy_pass to location / in NGINX
Hello ,
I am trying to set custom proxy_pass directive for location / on the following path : /etc/nginx/conf.d/users/myuser.conf , however after some time , the configuration will be overwritten after couple of days/hours. So each time I have to copy preconfigured file and reload nginx configuration to make my site being available to users.
Is there any way I can make my user configuration permanent ?
-
Hey there! You'll want to use an include file for that user as outlined here:
Can you try that and let me know if that works for you?
0 -
Hello cPRex,
Please explain how can I include location / {} server block in my include file, since I can't use it twice as this directive has been used in the default user config?
This is the error that I'm getting:
nginx: [emerg] duplicate location "/" in /etc/nginx/conf.d/users/yumidi/include.conf:10 -
You shouldn't need to add the global lines to that file as well - the includes are read in addition to the main configuration, not instead of.
0 -
Sure I am aware of that, but I need to change proxy_pass directive for the global location. Is it possible to do it in any way?
0 -
I did some testing with another technician and it doesn't look like a permanent modification to this area is possible within the current software. I have two recommendations for your situation that might help:
-configure a cron that runs after the nightly cPanel update to put your changes back in place after the file is overwritten
-submit a feature request at features.cpanel.net to see if this is a function we'd consider adding.I'm sorry I don't have better news on this one but let me know if you need anything else.
0
Please sign in to leave a comment.
Comments
5 comments