Serving multiple domains with Django and Apache maps to one location only - django

I am attempting to setup Django to serve multiple sites (in the below configuration I am using examples www.domain1.com and www.domain2.com). I have installed Apache2 successfully, configured wsgi.py successfully (or so it seems).
I have built my appache configuration file to attempt the following mapping:
www.example1.com to serve from /var/www/mysite1
www.example2.com to serve from /var/www/mysite2
DNS A records for both example1.com and example2.com point to the same IP address.
The trouble with my setup as it exists is that both domain1.com and domain2.com map to the Django residing at /var/www/mysite1, despite the fact that I have (in theory) set them to map to their respective locations.
My apache config files are as follows, and both of the files (mysite1.conf and mysite2.conf) have had symlinks made for them using a2ensite:
#/etc/apache2/sites-available/mysite1.conf
WSGIDaemonProcess mysite processes=2 threads=25 python-home=/var/www/mysite1/myenv1 python-path=/var/www/mysite1/myenv1/mys
ite1
WSGIProcessGroup mysite
WSGIScriptAlias / /var/www/mysite1/myenv1/mysite1/mysite1/wsgi.py
<VirtualHost *:80>
ServerName domain1.com
ServerAlias xx.xx.xx.xx
DocumentRoot /var/www/mysite1
ErrorLog ${APACHE_LOG_DIR}/mysite1-error.log
CustomLog ${APACHE_LOG_DIR}/mysite1-access.log combined
Alias /robots.txt /var/www/mysite1/myenv1/mysite1/static/robots.txt
Alias /favicon.ico /var/www/mysite1/myenv1/mysite1/static/favicon.ico
Alias /static/ /var/www/mysite1/myenv1/mysite1/static/
<Directory /var/www/mysite1/myenv1/mysite1/mysite1>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
<Directory /var/www/mysite1/myenv1/mysite1/static>
Require all granted
</Directory>
</VirtualHost>
#/etc/apache2/sites-available/mysite2.conf
WSGIDaemonProcess mysite2 processes=2 threads=25 python-home=/var/www/mysite2/myenv2 python-path=/var/www/mysite2/myenv
2/mysite2
WSGIProcessGroup mysite2
WSGIScriptAlias / /var/www/mysite2/myenv2/mysite2/mysite2/wsgi.py process-group=mysite2
WSGISocketPrefix /var/run/wsgi
<VirtualHost *:80>
ServerName domain2.com
ErrorLog ${APACHE_LOG_DIR}/mysite2-error.log
CustomLog ${APACHE_LOG_DIR}/mysite2-access.log combined
DocumentRoot /var/www/mysite2
Alias /robots.txt /var/www/mysite2/myenv2/mysite2/static/robots.txt
Alias /favicon.ico /var/www/mysite2/myenv2/mysite2/static/favicon.ico
Alias /static/ /var/www/mysite2/myenv2/mysite2/static/
<Directory /var/www/mysite2/myenv2/mysite2/mysite2>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
<Directory /var/www/mysite2/myenv2/mysite2/static>
Require all granted
</Directory>
</VirtualHost>
An example wsgi.py file looks as below, and is working correctly (ie loading from the correct location) when it does load:
import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite1.settings'
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite1.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
There are no errors being reported in either logs (/var/syslog/apache2/mysiteX.conf where x=1 or 2)
What am I doing wrong? How can I correct this so that domain2 starts to map to /var/www/mysite2?
Many thanks in advance!

The WSGI tags need to be inside the VirtualHost block for their respective domain names.
E.g.
<VirtualHost *:80>
ServerName domain1.com
ServerAlias xx.xx.xx.xx
DocumentRoot /var/www/mysite1
WSGIDaemonProcess mysite processes=2 threads=25 python-home=/var/www/mysite1/myenv1 python-path=/var/www/mysite1/myenv1/mys
ite1
WSGIProcessGroup mysite
WSGIScriptAlias / /var/www/mysite1/myenv1/mysite1/mysite1/wsgi.py
...
</VirtualHost>

Related

Serving Multiple WSGI Applications As Different Virtual Hosts on Apache

I have an EC2 AWS server on which I would like to host a couple of Django applications. Each of these apps has its own URL. For instance,
example1.com
example2.com
By itself, example1.com works. The problem is getting example2.com to work with it at the same time.
When I visit example2.com, I get an error:
DisallowedHost at /
Invalid HTTP_HOST header: 'example2.com'. You may need to add 'example2.com' to ALLOWED_HOSTS.
Request Method: GET
Request URL: http://example2.com
Django Version: 1.9.13
Exception Type: DisallowedHost
Exception Value:
Invalid HTTP_HOST header: 'example2.com'. You may need to add 'example2.com' to ALLOWED_HOSTS.
Exception Location: /var/www/vhosts/example1/example1-env/lib/python3.5/site-packages/django/http/request.py in get_host, line 109
Python Executable: /usr/bin/python3
Python Version: 3.5.1
Python Path:
['/usr/lib64/python3.5',
'/usr/lib64/python3.5/plat-linux',
'/usr/lib64/python3.5/lib-dynload',
'/usr/local/lib64/python3.5/site-packages',
'/usr/local/lib/python3.5/site-packages',
'/usr/lib64/python3.5/dist-packages',
'/usr/lib/python3.5/dist-packages',
'/var/www/vhosts/example1/',
'/var/www/vhosts/example1/example1-env/lib/python3.5/site-packages']
Server time: Wed, 14 Jun 2017 20:31:27 +0000
As you can see, somehow Apache is trying to use the virtual environment of example1.com when it serves example2.com. How could I correct that? Each one should be served with its own virtualenv.
Here is the Apache configuration file:
<VirtualHost *:80>
# This is name based virtual hosting. So place an appropriate server name
# here. Example: django.devsrv.local
ServerName example1.com
WSGIDaemonProcess example1 python-home=/var/www/vhosts/example1/example1-env
WSGIProcessGroup %{GLOBAL}
# Insert the full path to the wsgi.py-file here
WSGIScriptAlias / /var/www/vhosts/example1/example1/wsgi.py
<Directory /var/www/vhosts/example1/>
Require all granted
</Directory>
Alias /static/ /var/www/vhosts/example1/static/
<Directory /var/www/vhosts/example1/static/>
Order deny,allow
Allow from all
</Directory>
Alias /media/ /var/www/vhosts/example1/media/
<Directory /var/www/vhosts/example1/media/>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
# This is name based virtual hosting. So place an appropriate server name
# here. Example: django.devsrv.local
ServerName example2.com
WSGIDaemonProcess example2 python-home=/var/www/vhosts/example2/example2-env
WSGIProcessGroup %{GLOBAL}
# Insert the full path to the wsgi.py-file here
WSGIScriptAlias / /var/www/vhosts/example2/example2/wsgi.py
<Directory /var/www/vhosts/example2/>
Require all granted
</Directory>
Alias /static/ /var/www/vhosts/example2/static/
<Directory /var/www/vhosts/example2/static/>
Order deny,allow
Allow from all
</Directory>
Alias /media/ /var/www/vhosts/example2/media/
<Directory /var/www/vhosts/example2/media/>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
Edit:
Having read some suggestions in the comments, I have come to this. This still does not work.
ServerName example1.com
WSGIDaemonProcess example1 display-name=%{GROUP} python-path=/var/www/vhosts/example1/ python-home=/var/www/vhosts/example1/example1-env/
WSGIApplicationGroup %{GLOBAL}
WSGIProcessGroup example1
# Insert the full path to the wsgi.py-file here
WSGIScriptAlias / /var/www/vhosts/example1/example1/wsgi.py process-group=example1
...
ServerName example2.com
WSGIDaemonProcess example2 display-name=%{GROUP} python-home=/var/www/vhosts/example2/example2-env/ python-path=/var/www/vhosts/example2/
WSGIApplicationGroup %{GLOBAL}
WSGIProcessGroup example2
# Insert the full path to the wsgi.py-file here
WSGIScriptAlias / /var/www/vhosts/example2/example2/wsgi.py process-group=example2
The following configuration worked for me. In short, it serves two different Django applications at example1.com and example2.com using their respective virtual environments.
As you can see, inserting the ServerAlias AND ServerName made all the difference, alongside a couple of other corrections by suggested by the community.
Apache configuration:
<IfModule !wsgi_module>
LoadModule wsgi_module modules/mod_wsgi.so
</IfModule>
<VirtualHost *:80>
ServerName www.example1.com
ServerAlias example1.com
WSGIDaemonProcess example1 display-name=%{GROUP} python-path=/var/www/vhosts/example1/ python-home=/var/www/vhosts/example1/example1-env/
WSGIApplicationGroup %{GLOBAL}
WSGIProcessGroup example1
# Insert the full path to the wsgi.py-file here
WSGIScriptAlias / /var/www/vhosts/example1/example1/wsgi.py process-group=example1
<Directory /var/www/vhosts/example1/>
Require all granted
</Directory>
Alias /static/ /var/www/vhosts/example1/static/
<Directory /var/www/vhosts/example1/static/>
Order deny,allow
Allow from all
</Directory>
Alias /media/ /var/www/vhosts/example1/media/
<Directory /var/www/vhosts/example1/media/>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName www.example2.com
ServerAlias example2.com
WSGIDaemonProcess example2 display-name=%{GROUP} python-home=/var/www/vhosts/example2/example2-env/ python-path=/var/www/vhosts/example2/
WSGIApplicationGroup %{GLOBAL}
WSGIProcessGroup example2
# Insert the full path to the wsgi.py-file here
WSGIScriptAlias / /var/www/vhosts/example2/example2/wsgi.py process-group=example2
<Directory /var/www/vhosts/example2/>
Require all granted
</Directory>
Alias /static/ /var/www/vhosts/example2/static/
<Directory /var/www/vhosts/example2/static/>
Order deny,allow
Allow from all
</Directory>
Alias /media/ /var/www/vhosts/example2/media/
<Directory /var/www/vhosts/example2/media/>
</VirtualHost>

run multiple django project in different virtualenv on apache

I want to run two different django_projects each in different virtualenv.
This is the code :
ServerName ubuntu_server_apache
<VirtualHost *:80>
ServerName dev.hexxie.com
ErrorLog "/home/ashish/deployments/mysite_dev/conf/mysite_dev_error.log"
WSGIScriptAlias / /home/ashish/deployments/mysite_dev/mysite/mysite/wsgi.py
Alias /static /home/ashish/deployments/mysite_dev/static_root
<Directory /home/ashish/deployments/mysite_dev/static_root>
Require all granted
</Directory>
Alias /media /home/ashish/deployments/mysite_prod/data/media
<Directory /home/ashish/deployments/mysite_prod/data/media>
Require all granted
</Directory>
<Directory /home/ashish/deployments/mysite_dev/mysite/mysite>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
WSGIPythonPath /home/ashish/deployments/mysite_dev/mysite:/home/ashish/.virtualenvs/mysite_dev/lib/python2.7/site-packages
<VirtualHost *:80>
ServerName hexxie.com
ServerAlias *.hexxie.com
ErrorLog "/home/ashish/deployments/mysite_prod/conf/mysite_error.log"
WSGIScriptAlias / /home/ashish/deployments/mysite_prod/mysite/mysite/wsgi.py
Alias /static /home/ashish/deployments/mysite_prod/static_root
<Directory /home/ashish/deployments/mysite_prod/static_root>
Require all granted
</Directory>
Alias /media /home/ashish/deployments/mysite_prod/data/media
<Directory /home/ashish/deployments/mysite_prod/data/media>
Require all granted
</Directory>
<Directory /home/ashish/deployments/mysite_prod/mysite/mysite>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
WSGIPythonPath /home/ashish/deployments/mysite_prod/mysite:/home/ashish/.virtualenvs/mysite_prod/lib/python2.7/site-packages
But I am getting internal server error using this apache conf. I feel that this is due to WSGIPythonPath used twice in conf. WSGIPythonPath can't be included inside virtualhost. So how to run two diff django project each on diff virtualenv on apache ?
For a start, use a daemon process group so each runs in a separate process and then use the python-home option on the respective WSGIDaemonProcess group directives. See:
http://blog.dscpl.com.au/2012/10/why-are-you-using-embedded-mode-of.html
http://blog.dscpl.com.au/2014/09/using-python-virtual-environments-with.html
Here's an example of how I do it. You'll have to change paths / project names based on your setup, naturally (example is SSL on port 443, but works on port 80 as well):
LoadModule wsgi_module modules/mod_wsgi.so
LoadModule ssl_module modules/mod_ssl.so
WSGISocketPrefix /var/run/wsgi
NameVirtualHost *:443
Listen 443
<VirtualHost *:443>
ServerName your.server.com
ErrorLog /home/user/apache_errors.log
WSGIDaemonProcess project1-https python-home=/home/user/.virtualenvs/project1
WSGIScriptAlias /project1 /var/www/html/project1/project1/wsgi.py process-group=project1-https application-group=project1-https
WSGIProcessGroup project1-https
Alias /project1/static/ /var/www/html/project1/static/
WSGIDaemonProcess project2-https python-home=/home/user/.virtualenvs/project2
WSGIScriptAlias /project2 /var/www/html/project2/project2/wsgi.py process-group=project2-https application-group=project2-https
WSGIProcessGroup project2-https
Alias /project2/static/ /var/www/html/project2/static/
</VirtualHost>
The virtualenv takes care of the Python executable and path when configured in this manner.

VirtualHost configuration doesn't allow second website to run

I have this in my /etc/apache2/sites-available/staginnx.com.conf
WSGIScriptAlias / /home/ubuntu/v1/staginnx-info/app/website/website/wsgi.py
WSGIPythonPath /home/ubuntu/v1/staginnx-info/app/website
<VirtualHost *:80>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin info#staginnx.com
ServerName staginnx.com
ServerAlias www.staginnx.com
<Directory /home/ubuntu/v1/staginnx-info/app/website/website>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Alias /static/ /home/ubuntu/v1/staginnx-info/app/website/ui/static/
<Directory /home/ubuntu/v1/staginnx-info/app/website/ui/static>
Require all granted
</Directory>
Alias /favicon.ico /home/ubuntu/v1/staginnx-info/app/website/ui/static/images/favicon.ico
ErrorLog /var/log/apache2/error.log
</VirtualHost>
<VirtualHost *:80>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin blog.staginnx#staginnx.com
ServerName blog.staginnx.com
ServerAlias blog.staginnx.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.php
DocumentRoot /var/www/html/blog/
<Directory /var/www/html/blog>
Require all granted
</Directory>
# Custom log file locations
LogLevel warn
ErrorLog /var/www/html/blog/log/error.log
CustomLog /var/www/html/blog/log/access.log combined
</VirtualHost>
Now the first one, the main website is working fine. The second one, BLOG is not working.
I have done sudo a2ensite staginnx.com.conf and a symlink is generated at sites-enabled. I have done reload apache and restart too.
Surfed around but no luck.
Want to install wordpress blog in my blog folder.
In order to use your django application inside a virtual host you need to set the WSGIScriptAlias inside the virtualhost settings and also you can't use the WSGIPythonPath, you need to use WSGIDaemonProcess like in the following settings.
<VirtualHost *:80>
WSGIScriptAlias / /home/ubuntu/v1/staginnx-info/app/website/website/wsgi.py
WSGIDaemonProcess example.com python-path=/home/ubuntu/v1/staginnx-info/app/website
# Admin email, Server Name (domain name) and any aliases
ServerAdmin info#staginnx.com
ServerName staginnx.com
ServerAlias www.staginnx.com
<Directory /home/ubuntu/v1/staginnx-info/app/website/website>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Alias /static/ /home/ubuntu/v1/staginnx-info/app/website/ui/static/
<Directory /home/ubuntu/v1/staginnx-info/app/website/ui/static>
Require all granted
</Directory>
Alias /favicon.ico /home/ubuntu/v1/staginnx-info/app/website/ui/static/images/favicon.ico
ErrorLog /var/log/apache2/error.log
</VirtualHost>
Also in case you want to host multiple application on the same host then you need to change a small setting in the wsgi.py file as well.
instead of using
os.environ.setdefault(DJANGO_SETTINGS_MODULE, "app.settings")
you should use
os.environ["DJANGO_SETTINGS_MODULE"] = "app.settings"
I hope this helps you.
For WSGIDaemonProcess setting

Deploy a Django site and a PHP site on the same server with Apache and mod_wsgi

I currently have a Django site working at cinepass.com.ec , I would like to deploy an additional PHP site to the same server at mobile.cinepass.com.ec
My current httpd.conf (from DjangoFoo) :
<Directory "/home/ec2-user/cinepass/media">
Order deny,allow
Allow from all
</Directory>
<Directory "/home/ec2-user/cinepass/cinepass">
AllowOverride All
Order deny,allow
Allow from all
</Directory>
Alias /media/ /home/ec2-user/cinepass/media/
ServerAdmin smansfield#palapa.com.ec
ErrorLog "logs/cinepass.com-error_log"
CustomLog "logs/cinepass.com-access_log" common
# mod_wsgi configuration is here
# we are running as user/group 'deamon', if you don't have those you need to change or create.
WSGIDaemonProcess cinepass python-path=/home/ec2-user/cinepass:/home/ec2-user/cinepass/venv/lib/python2.6/site-packages user=daemon group=daemon processes=2 threads=25
WSGIProcessGroup cinepass
# this is our WSGI file.
WSGIScriptAlias / /home/ec2-user/cinepass/cinepass/wsgi.py
My current wsgi.py :
import os, sys
sys.path.append('/home/')
sys.path.append('/home/ec2-user/cinepass/')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cinepass.settings_production.py")
os.environ['PYTHON_EGG_CACHE'] = '/tmp'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
How would I edit my Apache configuration so that I can also run a php site at mobile.cinepass.com.ec?
Using apache´s virtualhosts, here I put an example of something similar in a server of mine, in which I have a djangp app in the main domain and a joomla in a subdomain. Both files are located in /etc/apache2/sites-enabled
Joomla´s apache conf file (named /etc/apache2/sites-enabled/manual.domain.com):
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin dsanabria#domain.com
ServerName manual.domain.com
DocumentRoot "/home/ubuntu/manual/"
<Directory /home/ubuntu/manual/>
Order deny,allow
Allow from all
</Directory>
ErrorLog /var/log/apache2/manual.domain-error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel debug
CustomLog /var/log/apache2/manual.domain-access.log combined
</VirtualHost>
And the django app (named /etc/apache2/sites-enabled/www.domain.co):
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin diego#diegue.us
ServerName domain.co
ServerAlias machete.anotherdomain.com
Alias /admin/media/ /home/ubuntu/webapps/machete/lib/python2.7/site-packages/grappelli/media/
Alias /media/ /home/ubuntu/webapps/machete/machete/media/
Alias /static/ /home/ubuntu/webapps/machete/machete/collected/
<Directory /home/ubuntu/webapps/machete/lib/python2.7/site-packages/grappelli/media/>
Order deny,allow
Allow from all
</Directory>
<Directory /home/ubuntu/webapps/machete/lib/python2.7/site-packages/django/contrib/admin/media/ >
Order deny,allow
Allow from all
</Directory>
<Directory /home/ubuntu/webapps/machete/machete/media/>
Order deny,allow
Allow from all
</Directory>
<Directory /home/ubuntu/webapps/machete/machete/collected/>
Order deny,allow
Allow from all
</Directory>
WSGIScriptReloading On
WSGIDaemonProcess machete python-path=/home/ubuntu/webapps/machete/lib/python2.7/site-packages
WSGIProcessGroup machete
WSGIApplicationGroup machete
WSGIPassAuthorization On
WSGIScriptAlias / /home/ubuntu/webapps/machete/machete/machete/wsgi.py
ErrorLog /var/log/apache2/machete-error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel debug
CustomLog /var/log/apache2/machete-access.log combined
</VirtualHost>
The first, tells to apache, that if the user gets to manual.domain.com, just response with a php application (joomla). The second file says to apache, that if the user calls the server with www.domain.com response with a python wsgy, (django).
This is in a ubuntu server, redhat/centos/fedora locates the folder sites-enabled in another location that I can´t remember, but anyway you can use virtualhosts.
Generraly, I avoid to mess with the httpd.conf file and prefer use virtualhosts.

Multiple domains all incorrectly point to the same VirtualHost with Django WSGI

I'm running Django using wsgi. I have two domains and one sub domain pointing to three seperate apache2 virtual hosts. For some (probably very obvious) reason each domain is landing to the same site (the first one that was put online using a2ensite). My configuration is as follows:
<VirtualHost *:80>
ServerName www.one.com/
ServerAlias one.com
ServerAdmin andy#one.com
DocumentRoot /srv/www/one.com/public_html
<Directory /srv/www/one.com/application>
Order allow,deny
Allow from all
</Directory>
WSGIDaemonProcess one.com processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup one.com
WSGIScriptAlias / /srv/www/one/application/apache/one.wsgi
Alias /robots.txt /srv/www/one.com/public_html/robots.txt
Alias /favicon.ico /srv/www/one.com/public_html/favicon.ico
Alias /media /srv/www/one.com/public_html/media
Alias /static /srv/www/one.com/public_html/static
ErrorLog /srv/www/one.com/logs/error.log
CustomLog /srv/www/one.com/logs/access.log combined
</VirtualHost>
////// /// one.wsgi //////////
import os
import sys
sys.path.append('/srv/www/one.com/application')
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
//////////////////
<VirtualHost *:80>
ServerName dev.one.co.uk/
ServerAlias www.dev.one.co.uk/
ServerAdmin andy#one.com
DocumentRoot /srv/www/dev.one.com/public_html
<Directory /srv/www/dev.one.com/application>
Order allow,deny
Allow from all
</Directory>
WSGIScriptAlias / /srv/www/dev.one.com/application/apache/devone.wsgi
Alias /robots.txt /srv/www/dev.one.com/public_html/robots.txt
Alias /favicon.ico /srv/www/dev.one.com/public_html/favicon.ico
Alias /media /srv/www/dev.one.com/public_html/media
Alias /static /srv/www/dev.one.com/public_html/static
ErrorLog /srv/www/dev.one.com/logs/error.log
CustomLog /srv/www/dev.one.com/logs/access.log combined
</VirtualHost>
//////// devone.wsgi ///////////
import os
import sys
sys.path.append('/srv/www/dev.one.com/application')
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
/////////////
<VirtualHost *:80>
ServerName dev.two.com/
ServerAlias www.dev.two.com/
ServerAdmin andy#two.com
DocumentRoot /srv/www/dev.two.com/public_html
<Directory /srv/www/dev.two.com/application>
Order allow,deny
Allow from all
</Directory>
WSGIScriptAlias / /srv/www/dev.two.com/application/apache/devtwo.wsgi
Alias /robots.txt /srv/www/dev.two.com/public_html/robots.txt
Alias /favicon.ico /srv/www/dev.two.com/public_html/favicon.ico
Alias /media /srv/www/dev.two.com/public_html/media
Alias /static /srv/www/dev.two.com/public_html/static
ErrorLog /srv/www/dev.two.com/logs/error.log
CustomLog /srv/www/dev.two.com/logs/access.log combined
</VirtualHost>
//////// devtwo.wsgi /////
import os
import sys
sys.path.append('/srv/www/dev.two.com/application')
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
The domains are all hitting my servers IP fine, but they all land on the same page. What am I missing? Thanks in advance!
Update:
NameVirtualHost *:80
Is declared in ports.conf
Make sure the vhosts definitions are being loaded in order, from most specific to least specific (ex, possibly by naming them 10_dev.two.com.conf, 20_dev.one.com.conf, 30_one.com.conf)
The ServerName and ServerAlias directives shouldn't have the trailing /