Groups

    Multiple VirtualHosts - Debian & Apache

    So I have a VM with Debian 7 installed, I have installed Apache and setup my virtual host file, as below

    _VirtualHost *:80_ (removed the <> tags as the site strips them off and replaced with _
    ServerAdmin [email protected]
    ServerName localhost

    DocumentRoot /var/www/
    ErrorLog /var/log/apache2/error.log
    LogLevel warn
    _/VirtualHost_

    which works fine when I browse to http://localhost

    However If I create another host file, lets call it 'test' and enable it via terminal with sudo a2ensite test

    _VirtualHost *:80_ (removed the <> tags as the site strips them off and replaced with _
    ServerAdmin [email protected]
    ServerName localhost

    DocumentRoot /var/www/test
    ErrorLog /var/log/apache2/error.log
    LogLevel warn
    _/VirtualHost_

    then browse to http://localhost/test I receive a blank page with the link http://localhost/test/?page=test

    Basically I would like to have multi sites, ie http://localhost - points to smf http://localhost/test - points to lets say a wordpress site.

    Am I missing something, as it doesn't display the 'test' page?

    Thanks

    2 Comments

    Both of those configs are point to the same name local name (ie localhost) you need to use two different hostnames. like localhost and localhost2.

    If all you want is multiple mini site you can have just one Virtualhost definition and have different or just have multiple folders in the /var/www test/test2/test3 this will then allow

    http://localhost/test
    http://localhost/test2
    http://localhost/test3

    Chris.

    Original Poster

    Hi Chris,

    Thanks for the response.

    Ok so now I have one default site vhost with the below

    _VirtualHost *:80_
    ServerAdmin [email protected]
    ServerName site1.com

    DocumentRoot /var/www/site1


    Options FollowSymLinks
    AllowOverride None




    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all


    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/


    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all



    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

    _/VirtualHost_

    _VirtualHost *:80_

    DocumentRoot /var/www/forums
    ServerName forums.site.com

    _/VirtualHost_

    which does work when I browse to localhost I receive site 1 when I browse to localhost/smf I receive site 2 (smf forum) however on site1(http://localhost), if I were to click a link ie login I receive the below

    Not Found

    The requested URL /login was not found on this server.
    Apache/2.2.22 (Debian) Server at localhost Port 80

    However site2, http://localhost/forums everything seems to work fine, is it because of the Allow Override settings and/or the .htaccess file ?

    Thanks
    Post a comment
    Avatar
    @
      Text
      Top Discussions
      1. Win a luxury five-star break for two in Paris with Le Bristol Paris and Eur…56
      2. Win a safari adventure & claim a free Chicago Town pizza coupon11
      3. Tv choice magazine Issue 391111
      4. win a hamper - orbit homes - kent commuter mag88

      See more discussions