CentOS - Virtual Host Problem

Discussion in 'Server Operation' started by destinedjagold, Oct 11, 2012.

  1. destinedjagold

    destinedjagold New Member

    Hello and good day everyone.

    Okay, so here I am again, with my original problem. I will try and provide the much needed information, in hopes that anyone can help me.

    I have set up a local LAN-only server with a CentOS PC.
    Note: only for local LAN access only.

    The server is fine and I can access it when I type the server's static I.P. address.
    Now, I wanted to simply type mywebsite.com to access the server, so, since I am using Windows 7 OS PC, I edited my host file located in C:/windows/system32/drivers/etc/hosts .
    Code: 	mywebsite.com 	# CentOS Server
    And with that, I can finally simply type mywebsite.com and I can access the CentOS server.

    And now, onto the problem...
    I have a php file that I needed to be displayed, which is located in var/www/html/location1/location2/location3/location4
    Simply typing mywebsite.com/location1/location2/location3/location4 works, but I want the server to directly display the php file located in that location by simply me typing mywebsite.com

    I want to directly access a specific php file to be displayed when I type mywebsite.com...
    I have written a .conf file for the server located in the /etc/httpd/conf.d with these codes...
    <VirtualHost *:80>
      ServerName  www.mywebsite.com
      ServerAlias mywebsite.com
      DocumentRoot /var/www/html/location1/location2/location3/location4
        Redirect 404 /favicon.ico
        <Location /favicon.ico>
            ErrorDocument 404 "No favicon"
      ErrorLog  /etc/httpd/conf/vhosts/log/location-error.log
    I restarted the service httpd, and afterwards, I typed mywebsite.com again, but it instead displays an error with the message
    Not Found
    The requested URL /location1/location2/location3/location4/login.php was not found on this server.
    Apache/2.2.15 (CentOS) Server at mywebsite.com Port 80
    The error log displays this...
    [Thu Oct 11 11:00:26 2012] [error] [client] File does not exist: /var/www/html/location1/location2/location3/location4/location1/location2/location3/location4
    I don't understand the error log. Why did it displayed location1/location2/location3/location4 twice?

    Any help would greatly appreciated. Thank you.

Share This Page