Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Thread Tools Display Modes
Old 28th September 2012, 11:50
destinedjagold destinedjagold is offline
Junior Member
Join Date: Aug 2012
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
Default CentOS Apache DNS - Virtual Host

Okay, so I have managed to fix my other issues through searching around Google, but now, I have stumbled yet again with another problem that I could neither fix nor search through Google.

Anyway, hello and good day pipz.

I am trying to create a local server through LAN connection. Other computers can already access the server by either typing the hostname or the I.P. address.

The default server root is /var/www/html, and the server displays an Apache Welcome page, since I removed the index.html in the said location.

I would want for the server to instantly throw me to a page I made, which is located inside a folder within the server root.

I can access the said page if I type the IP address, followed by slashes and names of the folder locations and then the file name, like so...
And the server displays it no problem.

Now though, I want to simply type "example.com" and the server automatically throws me to the index.php within loc1 and loc2 folders.
After researching, I found out that I needed to write a Virtual Host within httpd.conf.
I did just that...
<VirtualHost example.com:80>

#    DocumentRoot /var/www/html
    DocumentRoot /var/www/html/loc1/loc2
    DirectoryIndex index.php
    ServerName example.com

    <Directory "/var/www/html/loc1/loc2">
        Order allow,deny
        Allow from all

    Redirect 404 /favicon.ico
    <Location /favicon.ico>
        ErrorDocument 404 "No favicon"

    ErrorLog /etc/httpd/logs/example-error.log

But after trying to type example.com, the server displays a white blank page. Accessing the error log files, it gave me this message.
Directory index forbidden by Options directive: /var/www/html/
I don't understand why that is happening. If I comment the file's location and uncomment the root location, the server displays the Apache Welcome page again, and if I type the location on the address bar, the index.php is displayed properly.

Any help would be appreciated.
Reply With Quote
Sponsored Links
Old 30th September 2012, 11:18
falko falko is offline
Super Moderator
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,751 Times in 2,581 Posts

<VirtualHost example.com:80>
Please use the IP address instead of the hostname:

(Replace with the server's IP.)
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
Old 1st October 2012, 05:41
destinedjagold destinedjagold is offline
Junior Member
Join Date: Aug 2012
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts

Thanks falko, but I already tried that method, and it gave me this error message...
[Mon Oct 01 10:20:58 2012] [error] [client] Directory index forbidden by Options directive: /var/www/html/
Any help would be greatly appreciated.
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache hangs without traffic Thesee General 21 28th September 2011 00:43
local ip:8080 just downloads a file called download or index.php dr_patso Installation/Configuration 5 20th September 2011 21:54
Fixing 404 Not Found Errors on Apache on Centos 5 x86_64 Dedi LinuxOnMyMac HOWTO-Related Questions 11 16th October 2010 05:29
Can't start apache Musty Server Operation 12 9th March 2008 14:58
Postfix problem: lost connection after CONNECT from unknown fernando_torrez Server Operation 5 30th November 2007 15:17

All times are GMT +2. The time now is 02:57.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.