I am able to run django and php on two different ports like this http://pastebin.com/2eextGad
But I want something like
54.22.22.22/app/ to django project
and anything other than that url to PHP Document root /var/www/
I tried running like Listen 8081
<VirtualHost *:8081>
WSGIScriptAlias /app/ /var/www/abc/index.wsgi
Alias /static/ /var/www/abc/static/
<Location "/static/">
Options -Indexes
</Location>
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Other than ip/app to php
Alias /var/www/
DocumentRoot /var/www
</VirtualHost>
How to accomplish this
I think this should just work:
<VirtualHost *:8081>
WSGIScriptAlias /app/ /var/www/abc/index.wsgi
Alias /static/ /var/www/abc/static/
<Location "/static/">
Options -Indexes
</Location>
LogLevel warn
CustomLog /var/log/apache2/access.log combined
DocumentRoot /var/www
</VirtualHost>
That makes addresses starting with /app/
to be served from a wsgi handler, addresses staring with /static/
from /var/www/abc/static/
directory, and everything else is served form /var/www
.
There is however a huge security issue with your setup. You should not keep your Django project in a folder that is inside a DocumentRoot folder. You are making all your source code and settings (including database passwords and cookie signing secret keys!) accessible to anyone. Move the Django project away from /var/www
immediately.