Serve django1.8 application at root and remain public_html in userdir.conf in apache

GOAL

I’m trying to put website of django 1.8 with apache setting on CentOS 7 root (/), but other users can still access their website by accessing http://hostname/~username to their public_html folder in PHP config. Is there any way to achieve this?

Error Message (with Debug=True)
enter image description here

userdir.conf

<IfModule mod_userdir.c>
    UserDir public_html
</IfModule>

<Directory "/home/*/public_html">
    AllowOverride FileInfo AuthConfig Limit Indexes
    Options +MultiViews -Indexes +SymLinksIfOwnerMatch +IncludesNoExec
    Require method GET POST OPTIONS
</Directory>

django.conf for hosting website of server at root

Alias /static /home/username-for-hosting-site/serversiteapp/static

<Directory /home/username-for-hosting-site/serversiteapp/static>
    Require all granted
</Directory>

<Directory /home/username-for-hosting-site/serversiteapp/>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

Other Information

Django Version: 1.8
Apache Version: 2.4.6
Server OS: CentOS 7
Other users could use PHP to hold their public_html sites


Source: apache

Leave a Reply