Set Up Apache

Apache Control

OSX goodies

This page is very raw, I'm marking this up right now.



Virtual hosts



Things to do:

Enable root 
Virtual hosts / domain name mapping
Virtual hosts in apache
Edit the apache configuration file
Documentation




Enable root (the master administrator account)

In the GUI, go /Applications/Utilities/Netinfo Manager
Click the lock at the bottom and give your password
Under the Domain menu pop up Security and choose 'enable root userr.

Now you can log in as root. You can run commands as root by running terminal and typing 'su' (switch user).

Only access root when you need it then log out, that will keep you from screwing things up by accident.








Virtual hosts / domain name mapping

The computer has to map your domain name to an ip address.  For a single virtual host you can set this up quickly in the network control panel. For many virtual hosts you use netinfo manager.

single virtual host

in terminal:
su
hostname www.domain.com
make the network control panel look like this:
img = 








Edit the apache configuration file

Change the permissions on httpd.conf so you can edit it

in the terminal type:

su
-- give the root password
chmod 775 /etc/httpd
chmod 775 /etc/httpd/httpd.conf

exit

-- 'exit' drops out of root and back to you. 

Now you should be able to open it and save it in textedit 

in the open dialog type /etc/httpd/httpd.conf into the goto: field and hit return.


Virtual hosts in apache

in httpd.conf uncomment the line (it should be near the bottom) that says:
    NameVirtualHost *
add a virtual host block for each domain name: DocumentRoot /www/domain ServerName www.domain.com DocumentRoot is the path to your web documents folder ServerName is your domain name (virtual host) See the documentation to read about all the things you can put in VirtualHost to customize it. restart apache Documentation httpd.apache.org has pretty good documentation but you should also have everything you need right on your own computer as part of the apache package. pop this page up in your browser: /Library/Documentation/Services/apache/index.html or http://localhost/manual/index.html