我正在运行 ubuntu 12.04 的服务器中设置网页。
我已经停用了默认站点( a2dissite default default-ssl ),并且我创建了一个新站点,我需要启动并工作的站点将是一个子域。
想象一下我有 foo.com。我的目标是 foo.com 抛出 403 http 错误,而 sub.foo.com 呈现我需要的网页。我的虚拟主机看起来像这样:
foo.com(默认)
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName foo.com
DocumentRoot /var/www/default
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/default/>
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 ${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
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>
sub.foo.com
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName sub.foo.com
DocumentRoot /var/www/sub
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/sub/>
Options Indexes 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}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/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>
当我访问 sub.foo.com 时,会显示该页面。当我访问 foo.com 时,显示相同的页面(:S),我需要 403 在这里...
我究竟做错了什么?