Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My setup is a bit awkward. I've got http://sub.main.com mapped to my server's IP but not the http://main.com. I am running two sites on my server(using different web frameworks). For each of those sites I've got virtual hosts configured in default site, which looks something like this.

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    ServerName "sub.main.com"
    DocumentRoot "/var/www"
    ....
</VirtualHost>

<VirtualHost *:80>
    ServerName appsphere.djangoserver
    Alias /media /srv/www/appsphere/media/
    ......
    ......
    WSGIScriptAlias / /srv/www/appsphere/apache/django.wsgi

</VirtualHost>

Now how can I make my second virtual host a subdirectory/subdomain of first virtual host. I want to access the second site using http://sub.main.com/appsphere

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

Change your first VirtualHost declaration to the following:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    ServerName "sub.main.com"
    DocumentRoot "/var/www"

    Alias /appsphere/media /srv/www/appsphere/media
    WSGIScriptAlias /appsphere /srv/www/appsphere/apache/django.wsgi

</VirtualHost>
share|improve this answer
    
Thanks, it worked. I needed to change the /media settings in second virtual host to /appsphere/media, but rest was a breeze. –  Neo Mar 27 '11 at 4:50
add comment

It should be as simple as adding a few lines to your first VirtualHost:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    ServerName "sub.main.com"
    DocumentRoot "/var/www"

    Alias /appsphere/media /srv/www/appsphere/media/
    ......
    ......
    WSGIScriptAlias /appsphere /srv/www/appsphere/apache/django.wsgi
</VirtualHost>

I don't know what you have in the "......." section that may need updating to reflect the path change as well.

share|improve this answer
add comment

Your Answer

 
discard

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.