1

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 [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, settings on default, added onto end:

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

Root directories:

DocumentRoot "/var/www/html"

1 Answer 1

3

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

2
  • 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, 2011 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, 2011 at 22:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .