debian apache 虛擬主機的問題
系統: Debian squeeze
apache 2.2.16 mysql 5.1.63 php5.3.3
apache配置了兩個虛擬主機,位於sites-enabled
域名1:www.a.com 網站 2: www.b.com DZ論壇
A的配置文件:<VirtualHost *:80> #此處我填寫的是真實ip,現在換成*,隱私問題,下同上
ServerAdmin xiaoluoinc@gmail.com
ServerName www.A.com
DocumentRoot /home/wwwroot/public_html
<Directory /home/wwwroot/public_html/>
Options FollowSymLinks MultiViews
AllowOverride All
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 ${APACHE_LOG_DIR}/octal/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/octal/access.log combined
</VirtualHost>B的配置文件<VirtualHost *:80>
ServerAdmin xiaoluoinc@gmail.com
ServerName www.B.com
DocumentRoot /home/apk/
<Directory /home/apk/>
Options 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 ${APACHE_LOG_DIR}/apk/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/apk/access.log combined
</VirtualHost>問題:
訪問A域名的時候正常,訪問B的時候訪問到的還是A的網頁。
或者有時候反過來,訪問A域名的時候,訪問到的是論壇。
求解?
《解決方案》
http://httpd.apache.org/docs/2.2/vhosts/name-based.html