Nginx Proxy - Redirect port XXXX to domain.tld

youds

Verified User
Joined
Jul 11, 2008
Messages
477
Location
Lancashire, UK
Hi

I'm working with nginx_apache and am modifying "nginx.conf proxy" under "Custom HTTPD Configurations". I'm following a guide, that is supposed to be legit (I paid for it to be written) but it isn't behaving as expected.

Basically, under the "Customize" button there is supposed to be the following entered:

Code:
#DO_NOT_REMOVE_ME This removes redundant proxy to apache later in 
|?NGINX_REDIRECTS=|

location / 
{
    proxy_pass http://domain.tld:XXXX;
    proxy_redirect      off;
    proxy_set_header    Host            $host;
    proxy_set_header    X-Real-IP       $remote_addr;
    proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
}

However it throws this error:
Code:
nginx: [emerg] duplicate location "/" in /usr/local/directadmin/data/users/repocode/nginx.conf:31
nginx: configuration file /etc/nginx/nginx.conf test failed

Looking at the nginx conf I can see that yes indeed there is another Location / block but I don't know how to remove it just for this domain.

Can anybody help?

Kind regards
 
Just to confirm:
Code:
include /usr/local/directadmin/data/users/repocode/nginx.conf;

Can be modified - how? Every time I change it on file it rewrites back to the original, as you would expect.

Kind regards
 
It'll rewrite by custombuild every times.

for simple.
Add to Custom1
Code:
|?PROXY_IP="domain.tld"|
|?PORT_8080="XXXX"|
 
Hi

Thanks for your reply.

Code:
nginx: [emerg] invalid port in upstream ""domain.tld":"XXXX"" in /usr/local/directadmin/data/users/repocode/nginx.conf:25
 
try remove ' " '

I not use too much about set variable
Maybe not need to use ' " '
 
Back
Top