I have multiple django applications on my server that run each within their own virtualhosts, bound to different ports. (I do this so as to isolate each WSGIProcessGroup).
Now I would like to proxy each application to the port 80 for a simplicity matter.
For one application, I do something like this:
Listen 8101
<VirtualHost 127.0.0.1:8101>
WSGIProcessGroup app1
WSGIDaemonProcess app1 display-name=%{GROUP}
WSGIScriptAlias /app1 "/var/django_apps/app1/app1.wsgi"
</VirtualHost>
<VirtualHost *:80>
ProxyPass /app1 http://localhost:8101/app1
ProxyPassReverse /app1 http://localhost:8101/app1
</VirtualHost>
Now, for simplicity in enabling or disabling some applications, when I have another app running, I have another .conf file containing this:
Listen 8102
<VirtualHost 127.0.0.1:8102>
WSGIProcessGroup app2
WSGIDaemonProcess app2 display-name=%{GROUP}
WSGIScriptAlias /app2 "/var/django_apps/app2/app2.wsgi"
</VirtualHost>
<VirtualHost *:80>
ProxyPass /app2 http://localhost:8102/app2
ProxyPassReverse /app2 http://localhost:8102/app2
</VirtualHost>
But this second <VirtualHost *:80>
is not used, which seems normal considering the apache configuration syntax.
However, I would like for this bit of config to live just beside the application declaration, so I can have things that belong together in just one file.
Would there be something I could do for that matter? I was thinking about using an include directive somehow, but I have very little knowledge about apache configuration, and i don't think I can find a solution all by myself :)
What do you think?
Cheers
The
include
directive would let you structure your proxy configuration like this:proxy.conf:
app1_proxy.conf:
app2_proxy.conf: