I am trying to setup Apache to serve multiple apps on one IP-Address over subdirectories. Lets say, I would like to access App1 over http://aaa.bbb.ccc.ddd/app1 and App2 over http://aaa.bbb.ccc.ddd/app2. Both, App1 and App2, are independent django projects. I ensured, that both apps are working fine by serving only one of them over Apache.
I added the following lines to the httpd.conf file of Apache:
# App1
<VirtualHost *:80>
DocumentRoot "D:/Projects/App1/App1"
ServerName App1
<Directory "D:/Projects/App1/App1">
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIScriptAlias /app1 "D:/Projects/App1/App1/wsgi.py"
</VirtualHost>
# App2
<VirtualHost *:80>
DocumentRoot "D:/Projects/App2/App2"
ServerName App2
<Directory "D:/Projects/App2/App2">
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIScriptAlias /app2 "D:/Projects/App2/App2/wsgi.py"
</VirtualHost>
Working like this results into an error saying "Forbidden, You don't have permission to access this resource." when I call http://aaa.bbb.ccc.ddd/app2 from another machine. Similar to this, if I put the App2 virtual host in front of the App1 virtual host, I can not access http://aaa.bbb.ccc.ddd/app1 anymore. So it is either App1 or App2 that is accessible, but never both of them.
First question: Is my idea of serving to webpages over sub-URL's even possible? If not, what would be the alternative? Using different ports for different applications? If it is a "valid" approach, why do I have access to just one but not both apps at with this configuration.
The purpose of the VirtualHost directive is to provide different applications based on the requested hosts. To resolve an application based on the directory, you may use the Alias directive instead of VirtualHost.