[Answer]-Django and PHP together in server with single ip and port only

1๐Ÿ‘

โœ…

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.

๐Ÿ‘คLudwik Trammer

Leave a comment