file management on os X with apache

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

  1. -elk- macrumors newbie

    Joined:
    Nov 1, 2006
    #1
    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

    Joined:
    Nov 17, 2005
    Location:
    Halifax, Canada
    #2
  3. Makosuke macrumors 603

    Joined:
    Aug 15, 2001
    Location:
    The Cool Part of CA, USA
    #3
    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

    Joined:
    Mar 25, 2003
    #4
    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.
     

Share This Page