I have to configure a Nginx server wich will be used as http(s) proxy and caching like a Apache server with proxy_pass and proxy_pass_reverse directives.
The system will be like this :
The nginx server respond to mydomain.com requests.
If I type mydomain.com/redmine, the nginx server have to proxy_pass on the internal adress (exemple : 192.168.0.207).
It's the same thing for other services (like mydomain.com/zabbix).
If I navigate on redmine, the URL will be mydomain.com/redmine/page1¶m[…]
It's like using multiple proxy_pass and proxy_pass_reverse directives on a apache vhost.
I have troubles with sites like Redmine because if I click on a link on Redmine, mydomain.com/redmine/page1 redirect on mydomain.com/page1 and that makes a 404 error (the webpage is searched on the nginx server).
If I type directly mydomain.com/redmine/page1 it works.
How can I fix this problem ?
Thank you
Edit:
This configuration don't works for me.
For example, I tried :
location /pma {
proxy_pass http://192.168.1.208/phpmyadmin;
proxy_redirect https://mydomain.com/ https://mydomain.com/pma/;
}
The login page is loaded correctly but when I try to log on, my browser open this link: http://mydomain.com/phpmyadmin/index.php?lang=[...]
and gets a 404 error.
Best Answer
The
proxy_redirect
directive can be used to modify redirects sent by backend servers. Based on your description of the behaviour, you need the following configuration:Try this for phpMyAdmin: