Welcome! Log In Create A New Profile

Advanced

Proxy pass and URL rewrite with upstream

M. Rodrigo Monteiro
December 21, 2017 09:10AM
Hi!

I'm new to nginx and I need you help do setup the way I need.
The server is nginx-1.12.2-1.el7.x86_64 (rpm) on CentOS 7.2 64.

My scenario is: all my systems are http://systems.ltda.local/NAME
(systems.ltda.local is nginx as reverse proxy)
The nginx must rewrite (or proxy, or whatever) to 4 Apaches servers
responding with the virtual host as NAME.ltda.local and the URL in the
browser must not change.

When a user types http://systems.ltda.local/phpmyadmin it goes to
nginx and nginx proxy to apache on the URL phpmyadmin.ltda.local but
the URL keeps the same on the browser.


My config:

# cat upstream.conf
upstream wpapp {
server XXX.XXX.XXX.XXX:80 fail_timeout=60;
server XXX.XXX.XXX.XXX:80 fail_timeout=60;
server XXX.XXX.XXX.XXX:80 fail_timeout=60;
server XXX.XXX.XXX.XXX:80 fail_timeout=60;
}

# cat systems.ltda.local.conf

server {
listen 80;
server_name systems.ltda.local;
access_log /var/log/nginx/systems.ltda.local_access.log;
error_log /var/log/nginx/systems.ltda.local_error.log;

location /phpmyadmin {
proxy_pass http://wpapp/;
sub_filter "http://systems.ltda.local/phpmyadmin"
"http://phpmyadmin.ltda.local";
sub_filter "http://systems.ltda.local/phpmyadmin/" "http://phpmyadmin.ltda/";
sub_filter_once off;
}

}

With this configuration, only works the URL with a trailing slash
"http://systems.ltda.local/phpmyadmin/" and not
"http://systems.ltda.local/phpmyadmin".

Best regards,
Rodrigo.
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Proxy pass and URL rewrite with upstream

M. Rodrigo Monteiro December 21, 2017 09:10AM

Re: Proxy pass and URL rewrite with upstream

Aziz Rozyev December 21, 2017 09:58AM

Re: Proxy pass and URL rewrite with upstream

tokers December 21, 2017 08:58PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 143
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready