Apache:禁止在虚拟主机上使用
Apache: forbidden on virtual host
我
/var/www/app.mydomain.com
这只包含 index.html
和
<h1>I want it works ... please</h1>
这是我的/etc/apache2/sites-enabled/app-mydomain-com.conf
<VirtualHost *:80>
ServerName app.mydomain.com
ServerAdmin info@mydomain.it
DocumentRoot /var/www/app.mydomain.com
CustomLog ${APACHE_LOG_DIR}/vhosts/app-mydomain-com/access.log vhost_combined
ErrorLog ${APACHE_LOG_DIR}/vhosts/app-mydomain-com/error.log
</VirtualHost>
当我在 app.mydomain.com 打开浏览器时,我收到了 apache 的禁止
在 error.log(主要的 error.log,不是我的虚拟主机的那个)我得到了
Cannot serve directory /var/www/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,
index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
我完全不知道这对我来说意味着什么
我尝试添加
DirectoryIndex index.html
但没有任何变化(当然是在重新启动 apache2 之后)
我确认网站已启用
a2ensite app-mydomain-com
Site app-mydomain-com already enabled
最后,问题只是缺少 ServerAlias
指令。
我
/var/www/app.mydomain.com
这只包含 index.html
和
<h1>I want it works ... please</h1>
这是我的/etc/apache2/sites-enabled/app-mydomain-com.conf
<VirtualHost *:80>
ServerName app.mydomain.com
ServerAdmin info@mydomain.it
DocumentRoot /var/www/app.mydomain.com
CustomLog ${APACHE_LOG_DIR}/vhosts/app-mydomain-com/access.log vhost_combined
ErrorLog ${APACHE_LOG_DIR}/vhosts/app-mydomain-com/error.log
</VirtualHost>
当我在 app.mydomain.com 打开浏览器时,我收到了 apache 的禁止
在 error.log(主要的 error.log,不是我的虚拟主机的那个)我得到了
Cannot serve directory /var/www/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php, index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
我完全不知道这对我来说意味着什么
我尝试添加
DirectoryIndex index.html
但没有任何变化(当然是在重新启动 apache2 之后)
我确认网站已启用
a2ensite app-mydomain-com
Site app-mydomain-com already enabled
最后,问题只是缺少 ServerAlias
指令。