file management on os X with apache

Discussion in 'Web Design and Development' started by -elk-, Nov 16, 2006.

  1. -elk- macrumors newbie

    Nov 1, 2006
    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?
  2. NoNameBrand macrumors 6502

    Nov 17, 2005
    Halifax, Canada
  3. Makosuke macrumors 603

    Aug 15, 2001
    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.
  4. nightelf macrumors 6502

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

    There is an app called Headdress. 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

    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. 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.

Share This Page