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.

We're hosting two sites and don't have a domain name at the moment so we're using the IP address. I want the two sites to be accessed in the following manner:

http://123.123.123.123/Site1
http://123.123.123.123/Site2

Site1 is a small About us type site. Site2 is a Django-based file upload site.

Here's my httpd.conf file:

WSGIPythonPath /var/www/Site2/src/site
Listen 80
NameVirtualHost *:80

# Site1
<VirtualHost *:80>
    ServerName Site1
    DocumentRoot /var/www/Site1
</VirtualHost>

# Site2
<VirtualHost *:80>
    ServerName Site2

    WSGIScriptAlias /Site2 /var/www/Site2/src/site/wsgi.py

    <Directory /var/www/Site2/src/site>
        <Files wsgi.py>
            Order deny,allow
            Allow from all
        </Files>
    </Directory>

    Alias /static/ /var/www/Site2/src/site/static/

    <Directory /var/www/Site2/src/site/static>
        Order deny,allow
        Allow from all
    </Directory>

    <Location /var/www/Site2/src/site/static/>
        AuthType Basic
        AuthName "site"
        AuthBasicProvider wsgi
        WSGIAuthUserScript /usr/local/wsgi/scripts/auth.wsgi
        Require valid-user
    </Location>
</VirtualHost>

123.123.123.123/Site1 works fine. Visiting 123.123.123.123/Site2 only yields the Index of /Site2 page.

If I re-order the VirtualHost declarations then Site2 works, but Site1 does not.

Am I missing something incredibly crucial?

I've seen this problem crop up on a number of search results and forums but I haven't yet found a solution.

share|improve this question
    
Possible duplicate of stackoverflow.com/questions/9505689/… –  trpt4him Jan 8 '13 at 17:38
    
That fixed my problem! Should this be closed or answered and accepted? –  þăדᴚῖↄқ Jan 8 '13 at 18:01
    
Not sure.. can't flag it since the answer is on Stack Overflow. I'll post below. –  trpt4him Jan 8 '13 at 21:15

1 Answer 1

up vote 0 down vote accepted

What you need is to use an Alias directive instead of a virtual host, since you're dealing with a single domain.

See the accepted answer to this post:

http://stackoverflow.com/questions/9505689/virtual-hosts-on-apache-with-urls-like-subfolders

share|improve this answer

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.