我怎样才能得到HTTPD服务的HTML / PHP文件,而不是列出/索引他们在虚拟主机的文件夹。 使用Centos 6.0

我的虚拟主机configuration如下,初始时我甚至无法进入/public_html/目录时,inputexample.com和Apache将只是服务于我的默认欢迎页面,我也会得到错误: Directory index forbidden by Options directive: /var/www/html/example.com/public_html/在日志中。 编辑welcome.conf页面( – 索引)后,当我现在键入example.com时,不会再显示/public_html/ contents(Index.php)在浏览器中编入索引。 在那里我想要它实际执行和diplay 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" 

在您的VirtualHost段落中设置DirectoryIndex index.php