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.
Reply
 
Thread Tools Display Modes
  #1  
Old 28th September 2012, 10: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...
Code:
example.com/loc1/loc2/index.php
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...
Code:
<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
    </Directory>

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

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

</VirtualHost>
But after trying to type example.com, the server displays a white blank page. Accessing the error log files, it gave me this message.
Code:
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.
Thankies~
Reply With Quote
Sponsored Links
  #2  
Old 30th September 2012, 10:18
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,740 Times in 2,575 Posts
Default

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

Code:
<VirtualHost 1.2.3.4:80>
(Replace 1.2.3.4 with the server's IP.)
__________________
Falko
--
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
  #3  
Old 1st October 2012, 04:41
destinedjagold destinedjagold is offline
Junior Member
 
Join Date: Aug 2012
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
 
Default

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

Bookmarks

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 27th September 2011 23:43
local ip:8080 just downloads a file called download or index.php dr_patso Installation/Configuration 5 20th September 2011 20:54
Fixing 404 Not Found Errors on Apache on Centos 5 x86_64 Dedi LinuxOnMyMac HOWTO-Related Questions 11 16th October 2010 04:29
Can't start apache Musty Server Operation 12 9th March 2008 13:58
Postfix problem: lost connection after CONNECT from unknown fernando_torrez Server Operation 5 30th November 2007 14:17


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


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