Apache vhosts config: Host Name instead of IP Address
        Posted  
        
            by 
                Johe Green
            
        on Server Fault
        
        See other posts from Server Fault
        
            or by Johe Green
        
        
        
        Published on 2012-08-31T15:20:00Z
        Indexed on 
            2012/08/31
            15:41 UTC
        
        
        Read the original article
        Hit count: 313
        
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 [email protected]
        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?
© Server Fault or respective owner