Issue
I am trying to route an application to a sub route on an internal server, using Gunicorn with my Django app. My virtual host file looks like this:
LoadModule proxy_module /usr/lib64/apache2/mod_proxy.so
LoadModule proxy_http_module /usr/lib64/apache2/mod_proxy_http.so
<VirtualHost *:80>
ServerName 172.16.1.81
<Location "/mycustomapp">
ProxyPreserveHost On
ProxyPass http://127.0.0.1:9090
ProxyPassReverse http://127.0.0.1:9090
</Location>
</VirtualHost>
When I navigate to 172.16.1.81/mycustomapp , I keep getting a 404 not found error when trying to navigate to the application on that route. Is there something else I am doing wrong here?
Solution
Okay, I figured it out. For anyone running into this type of problem in the future, the solution lies in using the ServerPath
directive inside your VirtualHost configuration. So for example, if you wanted to have an application be served at 172.15.1.20/app1 and another application served at 172.15.1.20/app2 (via port forwarding to a process listening on a port) the virtual host configuration would like the following:
LoadModule proxy_module /usr/lib64/apache2/mod_proxy.so
LoadModule proxy_http_module /usr/lib64/apache2/mod_proxy_http.so
<VirtualHost *:80>
ServerName 172.15.1.20
ProxyPreserveHost On
ProxyPass /app1 http://127.0.0.1:9090
ProxyPassReverse /app1 http://127.0.0.1:9090
ProxyPass /app2 http://127.0.0.1:9080
ProxyPassReverse /app2 http://127.0.0.1:9080
</VirtualHost>
Answered By - Jasonca1 Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.