0

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&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

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.

mgorven
  • 30,036
  • 7
  • 76
  • 121

1 Answers1

0

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_pass http://192.168.0.207;
proxy_redirect http://mydomain.com/ http://mydomain.com/redmine/;

Try this for phpMyAdmin:

proxy_pass http://192.168.1.208/phpmyadmin/;
proxy_redirect http://mydomain.com/phpmyadmin/ http://mydomain.com/pma/;
mgorven
  • 30,036
  • 7
  • 76
  • 121
  • Added suggestion for phpMyAdmin. – mgorven May 24 '12 at 04:44
  • It don't works but when I try to log on, it sends me to http://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[...] –  May 24 '12 at 05:57