homepage Welcome to WebmasterWorld Guest from 54.242.231.109
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / WebmasterWorld / The Macintosh Webmaster
Forum Library, Charter, Moderators: travelin cat

The Macintosh Webmaster Forum

    
Having a lot of trouble setting up local dev server
hosts file is my current problem
edzillion




msg:4214423
 6:49 pm on Oct 9, 2010 (gmt 0)

Hi

I (or rather a girl I really like) is trying to set up a local dev server on her mac. I have XAMPP installed and working. I then downloaded her current site to the local machine and can get the homepage up on localhost/thesite. I was then trying to edit the hosts file to redirect all links from http://www.example.com to localhost/thesite so that she can develop the site locally and then upload when complete (she has a really slow internet connection).

If I add the line:
127.0.0.1 www.example.com
to the hosts file and then go to www.example.com on a browser I get the XAMPP hompage. That makes sense. But since the local site is really located in localhost/thesite I instead tried:

127.0.0.1/thesite www.example.com
&
localhost/thesite www.example.com

neither of which worked. it just gave me the XAMPP homepage again when I went to www.example.com in my browser.

When I put the whole site into the root web folder in XAMPP and went to localhost it seemed to go straight to the online page (www.example.com)

any help would be appreciated.

[edited by: travelin_cat at 8:51 pm (utc) on Oct 9, 2010]
[edit reason] Changed example URL to example.com [/edit]

 

lammert




msg:4214623
 5:02 am on Oct 10, 2010 (gmt 0)

Getting the requests to the right location is a two way process. First of all you have to map the domain name to the IP address. This is done with your first example line:

127.0.0.1 www.example.com

You then have to tell the Apache webserver that the documents start at the directory /thesite. You can't do this in the hosts file because that file is only used for the translation of IP addresses and domain names. You have to edit the Apache configuration file called httpd.conf and make your changes there.

In the httpd.conf file you will find a DocumentRoot tag. If you change the directory following it to the directory where you have placed your file, it should work. Be sure that the directory tree where the development files are is readable by Apache. It has to readable both on the operating system level, and with the correct Allow/Deny statements in the httpd.conf.

If you can't get the permissions right, it may be better to move the development files to the location which was originally mentioned in the DocumentRoot setting in the httpd.conf. That location should be readable by Apache.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / The Macintosh Webmaster
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved