Pejman Moghadam / Slackware

Slackware 13.1 - Simple apache2 virtual host example

Public domain


/etc/httpd/httpd.conf

Listen 8000
Listen 8001
Include /etc/httpd/extra/httpd-vhosts.conf

/etc/httpd/extra/httpd-vhosts.conf

NameVirtualHost *:8001
NameVirtualHost *:8000

<VirtualHost *:8000>
    ServerAdmin webmaster@localhost
    DocumentRoot "/srv/httpd/htdocs/"
    CustomLog "/var/log/httpd/access_log" combined 
</VirtualHost>

<VirtualHost *:8001>
    ServerAdmin webmaster@localhost
    DocumentRoot "/srv/httpd/alert/"

    <Directory />
      Options FollowSymLinks
      AllowOverride All
    </Directory>

    <Directory /srv/httpd/alert> 
      Options Indexes FollowSymLinks MultiViews
      AllowOverride All
      Order allow,deny
      allow from all
    </Directory>

    CustomLog "/var/log/httpd/access_log" combined
</VirtualHost>

/etc/httpd/extra/httpd-vhosts.conf

NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot "/srv/www/htdocs/default"
    ServerName default.com
    ServerAlias www.default.com
    ErrorLog "/var/log/httpd/default.com-error_log"
    CustomLog "/var/log/httpd/default.com-access_log" common
    <Directory "/srv/www/htdocs/default">
        Options Indexes FollowSymLinks
        AllowOverride All 
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/srv/www/htdocs"
    ServerName mahestan.info
    ServerAlias www.mahestan.info
    ErrorLog "/var/log/httpd/mahestan.info-error_log"
    CustomLog "/var/log/httpd/mahestan.info-access_log" common
    <Directory "/srv/www/htdocs">
        Options Indexes FollowSymLinks
        AllowOverride All 
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/srv/www/htdocs/zhost"
    ServerName zhost.ir
    ServerAlias www.zhost.ir
    ErrorLog "/var/log/httpd/zhost.ir-error_log"
    CustomLog "/var/log/httpd/zhost.ir-access_log" common
    <Directory "/srv/www/htdocs/zhost">
        Options Indexes FollowSymLinks
        AllowOverride All 
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

BY: Pejman Moghadam
TAG: apache, virtual-host
DATE: 2011-10-12 23:38:20


Pejman Moghadam / Slackware [ TXT ]