
28th September 2012, 10:50
|
|
Junior Member
|
|
Join Date: Aug 2012
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
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~
|
Recent comments
13 hours 44 min ago
20 hours 25 min ago
1 day 16 min ago
1 day 1 hour ago
1 day 10 hours ago
1 day 19 hours ago
1 day 20 hours ago
2 days 11 min ago
2 days 4 hours ago
2 days 4 hours ago