0
我在運行ubuntu 12.04的服務器中設置了一個網頁。使用apache2和虛擬主機的子域配置
我已經停用了默認網站(a2dissite default default-ssl),並且我已經創建了一個新的,我需要和工作的那個將是一個子域。
想象我有foo.com。 我的目標是,foo.com拋出一個403 HTTP錯誤和sub.foo.com呈現網頁,我需要。 我的虛擬主機是這個樣子:
foo.com(默認)
<VirtualHost *:80>
ServerAdmin [email protected]
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 [email protected]
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 ...
我在做什麼錯?