1 vhost for php and python-django

Kernels & Hardware, configuring network, installing services

1 vhost for php and python-django

Postby kmchen » 2018-05-11 13:02


On a Debian Stretch Apache 2.4 I'm asked to create an entry to a python/django application on a vhost holding a php website. The website served as http://website.com, the python/django application would be accessed as http://website.com/djangoApp

I know to do this for a normal python application using Alias directive. But Django requires specific settings I found here: https://docs.djangoproject.com/fr/2.0/howto/deployment/wsgi/modwsgi/ that I did not succeed to implement in my specific access per subdirectory needs.

That trial, for example, when accessing to http://website.com/djangoApp leads to the djangoApp directory listing instead of executing scripts:

Code: Select all
<VirtualHost *:80>
        ServerAdmin webmaster@website.com
        ServerName www.website.com

    <Directory /var/www/djangoApp/>
        <Files wsgi.py>
            Require all granted

    WSGIDaemonProcess djangoApp python-path=/var/www/djangoApp python-home=/home/user/Envs/djangoApp
    WSGIProcessGroup djangoApp
    WSGIScriptAlias /djangoApp /var/www/djangoApp//wsgi.py

        Alias /djangoApp /var/www/djangoApp

        WSGIScriptAlias /djangoApp/ /var/www/djangoApp/djangoApp/wsgi.py

        <Directory /var/www/djangoApp>
                Require all granted

        DocumentRoot /var/www/wp-cfa/
        <Directory />
                Options FollowSymLinks
                AllowOverride All

        <Directory /var/www/wp-cfa/>
                Options FollowSymLinks MultiViews Includes
                AllowOverride All
                Require all granted

        <Location /php5-fpm-status>
                Action php5-fcgi /cgi-bin/fast-cgi-fake-handler virtual
                SetHandler php5-fcgi

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Require all granted

        ErrorLog ${APACHE_LOG_DIR}/error.log

Any help apreciated
Développeur WEB
Posts: 29
Joined: 2013-04-24 06:29

Return to System configuration

Who is online

Users browsing this forum: No registered users and 8 guests