WEB: Tutorial on Subdomains on Apache 2.2.x

Step 1: Uncomment the following in httpd.conf

#Include conf/extra/httpd-vhosts.conf

Step 2: Add the following to C:\windows\system32\drivers\etc\hosts file:

127.0.0.1 localhost
127.0.0.2 svn.localhost
127.0.0.3 mediawiki.localhost

Step 3: Add the following to the extra/httpd-vhosts.conf

NameVirtualHost *

<VirtualHost 127.0.0.1>
    DocumentRoot "C:/Konami/Web/Apache/htdocs"
    ServerName localhost.com
    ServerAlias www.localhost.com
</VirtualHost>

<VirtualHost 127.0.0.2>
    DocumentRoot "C:/Konami/Web/Apache/htdocs/svn"
    ServerName svn.localhost.com
    ServerAlias www.svn.localhost.com
</VirtualHost>

<VirtualHost 127.0.0.3>
    DocumentRoot "C:/Konami/Web/Apache/htdocs/mediawiki"
    ServerName mediawiki.localhost.com
    ServerAlias www.mediawiki.localhost.com
    <Directory "C:/Konami/Web/Apache/htdocs/mediawiki">
        Options Indexes FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
    <IfModule dir_module>
        DirectoryIndex index.php
    </IfModule>
</VirtualHost>

Step 4: You can now access the following subdomains:

http://svn.localhost
http://mediawiki.localhost

No comments: