Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a domain ( hosted at an external provider. I directed the subdomain 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>
        DocumentRoot /var/www/

        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/

        <Directory /home/application/>
                        Order allow,deny
                        Allow from all

When I enter 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

Here is my 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)
share|improve this question
You mean in the address bar? – Kyle Smith Aug 31 '12 at 15:22
Most likely the Python application has a certain URL that it considers "canonical" (the IP address) and is redirecting requests to other domains to that URL. Is there any configuration in your application to manage that? – Shane Madden Aug 31 '12 at 15:25
Yes. I can also enter and get to the right page but then the address in the browser is rewritten to . Where is the ip of my server obviously :) – j7nn7k Aug 31 '12 at 15:25
@ShaneMadden it's a standard django app. I did not configure anything domain or url related specifically... – j7nn7k Aug 31 '12 at 15:30
It does sound like there's a redirect going on. Use your browser's developer tools (or firebug for firefox) to watch the network requests. You should see a 301 or 302 on the request, and probably a 200 on the IP request – DTest Aug 31 '12 at 15:38
up vote 0 down vote accepted

Following DTest's tip I figured out that there was just a redirect from my domain provider. My domain provider did just a redirect instead of a real DNS A record entry to Added the DNS A record and now "It works!". Thanks guys!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.