Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

-elk-

macrumors newbie
Original poster
Nov 1, 2006
7
0
hi, after basically copying all of my sites from my xp machine to a folder in my /usr/documents folder im not intersted in setting up mac ox as a local testing server, which i managed succsessfully to do and enable php...

but now im wondering in order to have a working localhost test server that i can basically use when i preview my sites in dreamweaver do i have to have all my sites stored under usr/sites ? i.e. the actual folder designated by os X, or is my whole system acting as a server and i should be able to test from any location?
 

Makosuke

macrumors 604
Aug 15, 2001
6,663
1,244
The Cool Part of CA, USA
Note also, if you didn't know, that the root of localhost (localhost/ that is) is mapped to /Library/WebServer/Documents/

I found that very handy for site testing with absolute paths (ones that start with /).

I'm quite sure you can remap stuff by editing apache config files as well, if you wanted some particular folder to show up but I've never tried it myself.
 

nightelf

macrumors 6502
Mar 25, 2003
272
1
If you have several sites you want to test, the best option is to edit the httpd.config.

There is an app called Headdress. http://headdress.twinsparc.com/. I lets you create two virtual hosts in your Mac for free. If you want more, you will need to buy it.

If you want to do it manually, open the httpd.config in the /etc/httpd/ folder, activate the Virtual Hosting, and create the entries in the file. You can search how to to this in Google.

You can have the site in any place, but I use my Sites folder.

<VirtualHost *:80>
DocumentRoot "/Users/youruser/Sites/macniatic-com"
ServerName macniatic-com
</VirtualHost>

Next, open the hosts file in /etc/, save a backup in your desktop. Create an entry using the same ServerName that you used in the httpd.config. Read the warning in the hosts file. Do not delete or edit the original content.


127.0.0.1 macniatic-com

My advice, do not use a valid domain address because the computer will not let you see the real site then, thats why I replace the . with a -.

Every time you change the httpd.config you will need to restart the Personal Web Sharing (Apache). Changes to the host file are applied right away.

Good luck, and send me a PM if you need more help.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.