Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 : 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&param[...] 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


This configuration don't works for me. For example, I tried :

location /pma {
    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.

share|improve this question

1 Answer 1

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:

proxy_redirect http://mydomain.com/ http://mydomain.com/redmine/;

Try this for phpMyAdmin:

proxy_redirect http://mydomain.com/phpmyadmin/ http://mydomain.com/pma/;
share|improve this answer
Added suggestion for phpMyAdmin. –  mgorven May 24 '12 at 4:44
It don't works but when I try to log on, it sends me to mydomain.com/pma/index.php?lang[...] with the login page again and if I try to log on again, I get the 404 error with mydomain.com/phpmyadmin/index.php?lang[...] –  user122183 May 24 '12 at 5:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.