Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

My virtual hosts are configured as below, initally I could not even get to the /public_html/ directory when typing example.com and apache would just serve me up the default welcome page, I would also get the error: Directory index forbidden by Options directive: /var/www/html/example.com/public_html/ in the log . After editing the welcome.conf page (- Index) so it does not show again when I now type example.com the/public_html/ contents (Index.php) are indexed in the browser. Where as I want it to actually execute and diplay the index.php page.

vhost.conf , located in etc/httpd/vhost.d/

NameVirtualHost *:80

    <VirtualHost *:80>
         ServerAdmin webmaster@example.com
         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 webmaster@example.org
         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, settings on default, added onto end:

Include /etc/httpd/vhosts.d/*.conf

Root directories:

DocumentRoot "/var/www/html"
share|improve this question

1 Answer 1

up vote 3 down vote accepted

Set DirectoryIndex index.php inside your VirtualHost paragraph(s).

share|improve this answer
    
Thanks, but for some reason PHP file is not interpreted/executed now. Where as before without virtual hosts it worked. Any idea? Thanks.. –  LaserBeak Nov 29 '11 at 2:34
    
@LaserBeak 1) This is a second question 2) It has already been answered 100 times on this page. There is a search box in the upper right corner. –  mailq Nov 29 '11 at 22:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.