Tuesday, November 2, 2010

本机上创建多个基于域名的虚拟主机

这是一些配置文件,使用这些配置文件后,就可使用eclipse来访问Eclipse建立的项目目录,而使用old则访问用户目录中的Apache2目录。
这是一个使用Apache2的基于域名的多个虚拟主机创建实例。但遗憾的是Apache在运行时,会有一个小小的警告
* Reloading web server config apache2
apache2: Could not reliably determine the server's fully
qualified domain name, using 127.0.1.1 for ServerName
不过,这些都素浮云,因为伊可以正常运行了。
127.0.0.1 localhost
127.0.1.1 westnorth-tablet
127.0.1.2 eclipse
127.0.1.3 old
192.168.1.100 pc1
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
/////////////etc/hosts


#NameVirtualHost 127.0.1.3
<VirtualHost *:80>
ServerAdmin webmaster@localhost
# ServerName old
DocumentRoot /home/westnorth/apache2
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/westnorth/apache2/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>
#########################/etc/apache2/default

NameVirtualHost 127.0.1.2
<VirtualHost 127.0.1.2>
ServerAdmin webmaster@localhost
ServerName eclipse
DocumentRoot /home/westnorth/workspace/php
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/westnorth/workspace/php/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>
#############################/etc/apache2/site-availvabale/eclipse

No comments:

Post a Comment