Saturday, October 21, 2006

Apache 2.2 Vhost configure

Build Vhost in "extra/httpd-vhosts.conf"



NameVirtualhost localhost
ServerAdmin root@localhost
DocumentRoot "/opt/httpd/htdocs"



# NameVirtualhost sqladmin.localhost
ServerAdmin webmaster@sqladmin.localhost
DocumentRoot "/opt/www/sqladmin"
ServerPath "/opt/www/sqladmin"
ServerName sqladmin.localhost
# ServerAlias sqladmin.localhost

Options Indexes FollowSymLinks MultiViews
IndexOptions FancyIndexing
AllowOverride None
DirectoryIndex index.php
Order Deny,allow
Allow from all

ErrorLog logs/sqladmin.localhost-error

#

# NameVirtualhost php.localhost
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot /opt/www/php
ServerPath /opt/www/php

Options Indexes FollowSymLinks MultiViews
AllowOverride None
DirectoryIndex /phpinfo.php
Order Deny,allow
Allow from all

ServerName php.localhost
ErrorLog logs/php-error_log
CustomLog logs/php-access_log common




Let test the config file!


fred@localhost:php$ sudo /opt/httpd/bin/httpd -S
VirtualHost configuration:
127.0.0.1:80 is a NameVirtualHost
default server localhost (/opt/httpd/conf/extra/httpd-vhosts.conf:29)
port 80 namevhost localhost (/opt/httpd/conf/extra/httpd-vhosts.conf:29)
port 80 namevhost sqladmin.localhost (/opt/httpd/conf/extra/httpd-vhosts.conf:35)
port 80 namevhost php.localhost (/opt/httpd/conf/extra/httpd-vhosts.conf:53)
Syntax OK

No comments:

Post a Comment