我的虚拟主机配置如下,最初我甚至无法在/public_html/
输入 example.com 时进入目录,而 apache 只会向我提供默认的欢迎页面,我还会Directory index forbidden by Options directive: /var/www/html/example.com/public_html/
在日志中收到错误:。编辑了 welcome.conf 页面 (- Index) 后,当我现在输入 example.com 时它不会再次显示,/public_html/
内容 (Index.php) 已在浏览器中编入索引。而我希望它真正执行并显示 index.php 页面。
vhost.conf ,位于 etc/httpd/vhost.d/
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName localhost
ServerAlias localhost.example.com
DocumentRoot /var/www/html/example.com/public_html/
ErrorLog /var/www/html/example.com/logs/error.log
CustomLog /var/www/html/example.com/logs/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName example.org
ServerAlias www.example.org
DocumentRoot /var/www/html/example.org/public_html/
ErrorLog /var/www/html/example.org/logs/error.log
CustomLog /var/www/html/example.org/logs/access.log combined
</VirtualHost>
httpd.conf,默认设置,添加到最后:
Include /etc/httpd/vhosts.d/*.conf
根目录:
DocumentRoot "/var/www/html"
答案1
DirectoryIndex index.php
在您的 VirtualHost 段落内设置。