/ Apache

Hosting your Django app with a PHP app

There might come a time when you need to host a Django and PHP site side by side on a single Linux box (Ubuntu in this case).

After installing your LAMP box simply create a new conf file with the site name such as django_site.com.conf in sites-enabled.

john@mysite:/etc/apache2/sites-enabled # cat django_site.com.conf 
WSGIPythonPath /usr/bin/python3 
<VirtualHost *:80> 
    ServerAdmin myemail@gmail.com 
    ServerName my_site_url 
    ServerAlias my_site_url
    WSGIScriptAlias / /path/to/django/project/wsgi.py
    Alias /static/ /var/www/html/static/ 
    <Directory /var/www/html/static>
        Require all granted 
    <Directory /path/to/django/project>
        <Files wsgi.py>
            Require all granted
     <Location "/static/">
         Options -Indexes 

Restart Apache server and it should work!

Have fun!

John Roach

John Roach

I am John Roach, a devops architect. Find more information here: https://johnroach.io/about/

Read More
Hosting your Django app with a PHP app
Share this