0

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.

0

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:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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