I'm using proxy_pass to run a node application in my Nginx server
I can't find the right place to put it so I edited
/usr/local/directadmin/data/users/civilcom/nginx.conf
file manually to make it work and they are correct.
As you know that file was created automatically by DirectAdmin and costume templates so every time my changes get reverted to original configurations.
My configuration is like this below
server
{
listen MY_SERVER_IP:80;
server_name DOMAIN.com www.DOMAIN.com ;
access_log /var/log/nginx/domains/DOMAIN.com.log;
access_log /var/log/nginx/domains/DOMAIN.com.bytes bytes;
error_log /var/log/nginx/domains/DOMAIN.com.error.log;
root /home/civilcom/domains/DOMAIN.com/public_html;
index index.php index.html index.htm;
include /usr/local/directadmin/data/users/civilcom/nginx_php.conf;
location /
{
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /nginx_static_files/
{
# access_log /var/log/nginx/access_log_proxy;
alias /home/civilcom/domains/DOMAIN.com/public_html/;
internal;
}
include /etc/nginx/webapps.conf;
}
I've tried to change templates but it seems we can't use inner if statement in Nginx conf files to check my DOMAIN.
Where are the right place and file to put my code in it?
Any help would be appreciated
Copy any configuration files you wish to edit to custombuild/custom/directoryname
, in this case nginx
. Then edit the files as desired, then run ./build rewrite_confs
from the custombuild
directory.