2👍
Here’s what my conf file looks like:
VirtualHost *:80>
ServerName www.domain.com
ServerAlias domain.com *.domain.com
DocumentRoot /var/www/domain
Alias /static/ /var/www/domain/static/
WSGIScriptAlias / /var/www/domain/django.wsgi
RewriteEngine On
RewriteCond %{HTTP_HOST} ^((?!www\.)[^.]+)\.domain.com$
RewriteRule ^/(.*)$ http://www.domain/invite/%1/$1 [QSA,P]
ErrorLog ${APACHE_LOG_DIR}/domain/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/domain/access.log combined
<Directory /var/www/domain/static>
Order deny,allow
Allow from all
</Directory>
<Directory /var/www/domain/>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
And here’s my .wsgi file:
import os
import sys
sys.path.append('/home/ubuntu/django')
sys.path.append('/home/ubuntu/django/domain')
os.environ['DJANGO_SETTINGS_MODULE'] = 'domain.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
I have a number of these files and they are all named by the domain name I’m using for the site. Make sure you’ve got the confs in sites-available
and you run a2ensite on each one and you should be good to go.
Let me know if you need anything else.
Source:stackexchange.com