I've got several HTTP services running on the same machine, on different ports. I'd like to use nginx as a reverse proxy, but I can't seem to get my setup quite right.
I'd like the following:
/fossil/
==>http://127.0.0.1:8080/fossil/index.php
/fossil/(whatever)
==>http://127.0.0.1:8080/(whatever)
/webmin/
==>http://127.0.0.1:10000/
- a few more specific locations to be served by nginx itself
- and everything else to be handled by Apache ==>
http://127.0.0.1:8001
It's the first two that seem to cause trouble; I want everything under /fossil/
to be handled by fossil, on port 8080; except the root itself, that one has to be handled by a special PHP page (under Apache).
What would be the way to go here?
Best Answer
Try the below config.
Be sure to see the comments in the
location = /fossil/
section. Also keep in mind that requests to /fossil/(whatever) become /(whatever), so any urls returned in your content should be /fossil/(whatever) and not /(whatever). If necessary you could use sub_filter on the nginx side to substitute /fossil/(whatever) for /(whatever) when the content is return to the client.