I have a domain (example.com
) hosted at an external provider. I directed the subdomain sub.example.com
to my ubuntu server (12.04 with apache2).
On my ubuntu server I have a vhost setup like this. The rest of the config is basically apache 2 standard:
<VirtualHost *:80>
ServerName sub.example.com
ServerAlias sub.example.com
ServerAdmin admin@sub.example.com
DocumentRoot /var/www/sub.example.com
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
WSGIScriptAlias / /home/application/sub.example.com/wsgi.py
<Directory /home/application/sub.example.com>
<Files wsgi.py>
Order allow,deny
Allow from all
</Files>
</Directory>
</VirtualHost>
When I enter http://sub.example.com
in my browser my application shows up fine. But the domain is replaced by the IP address of my server. Do I have to configure my server somewhere else to deliver all its content under my domain sub.example.com
?
Here is my wsgi.py file:
import os
import sys
from os.path import abspath, dirname, join
PROJECT_ROOT = abspath(dirname(dirname(__file__)))
GIT_ROOT = abspath(dirname(dirname(PROJECT_ROOT)))
sys.path.insert(0, join(GIT_ROOT, 'venv', 'lib', 'python2.7', 'site-packages'))
sys.path.insert(0, PROJECT_ROOT)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xxx.settings")
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
# Apply WSGI middleware here.
# from helloworld.wsgi import HelloWorldApplication
# application = HelloWorldApplication(application)