Virtual Hosts Question

Home » CentOS » Virtual Hosts Question
CentOS 2 Comments

I am running WordPress on a CentOS 6.5 server which is behind a router. The private IP is 192.168.0.99, the public URL is X.com (name changed).

I have two virtual hosts in my httpd.conf file. The second one, listed below, is for WordPress and it is accessed with http://X.com/d4i or http://www.X.com/d4i. They work fine.

Actually, not show, I have more WordPress virtual hosts, and they are accessed with http://X.com/s1, http://X.com/s2, etc. and they work.

I want the first virtual host to be a default and accessed whenever a user types http://X.com (no sub directory). There is a valid
/var/www/html/index.html file.

Unfortunately it doesn’t work. The error is “Directory index forbidden by Options directive: /var/www/wordpress/” and googling didn’t help.

I have my httpd.conf and error.log below.

Thank you, Joe

============== httpd.conf =============ServerName 192.168.0.99

NameVirtualHost *:80


ServerName IDoNotExist.com
DocumentRoot /var/www/html
DirectoryIndex Index.html index.html


ServerName X.com
ServerAlias www.X.com
DocumentRoot /var/www/wordpress
DirectoryIndex Index.html index.html index.php Index.php
CustomLog logs/access_log_custom common

============== httpd.conf =============
========Tail of error.log =================[Thu Feb 06 10:25:48 2014] [notice] suEXEC mechanism enabled (wrapper:
/usr/sbin/suexec)
[Thu Feb 06 10:25:48 2014] [notice] Digest: generating secret for digest authentication …
[Thu Feb 06 10:25:48 2014] [notice] Digest: done
[Thu Feb 06 10:25:49 2014] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3
configured — resuming normal operations
[Thu Feb 06 10:26:01 2014] [error] [client 24.118.254.66] Directory index forbidden by Options directive: /var/www/wordpress/
[Thu Feb 06 10:26:01 2014] [error] [client 24.118.254.66] File does not exist: /var/www/wordpress/favicon.ico
============== error.log =============

2 thoughts on - Virtual Hosts Question

  • I have about 20+ virtual hosts.

    In my Virtual Hosts Apache entries I have

    I never have * as a domain name.

    I do not have: ServerAlias

    I have: ErrorLog /xxxx/xxxx/err.xxxx

    ——————

  • update your httpd.conf…
    http://httpd.apache.org/docs/2.2/mod/core.html#options

    ============== httpd.conf =============ServerName 192.168.0.99

    NameVirtualHost *:80


    Options Indexes FollowSymLinks

    < VirtualHost *:80>
    ServerName IDoNotExist.com
    DocumentRoot /var/www/html
    DirectoryIndex Index.html index.html
    < /VirtualHost>

    < VirtualHost *:80>
    ServerName X.com
    ServerAlias http://www.X.com <http://www.x.com/>
    DocumentRoot /var/www/wordpress
    DirectoryIndex Index.html index.html index.php Index.php
    CustomLog logs/access_log_custom common
    < /VirtualHost>
    ============== httpd.conf =============