Return to Snippet

Revision: 1115
at September 11, 2006 18:03 by jonhenshaw


Updated Code
//This is the code that goes in the vhosts.conf file (/private/etc/httpd/users/vhosts.conf)
//Substitute domain.web for domain you will use to access the vhost on your computer.
//For example, if I was working on cnn.com, I would change domain.web to cnn.web. For the
//document root I would change domain.com to cnn.com.

<VirtualHost *:80>
	ServerName domain.web
	DocumentRoot /Library/WebServer/Documents/domain.com/
</VirtualHost>

//This is the command line to be used in Terminal.app to restart Apache gracefully.

sudo apachectl -k graceful

Revision: 1114
at September 11, 2006 17:50 by jonhenshaw


Updated Code
//This is the code that goes in the vhosts.conf file (/private/etc/httpd/users/vhosts.conf)
//Substitute domain.web for domain you will use to access the vhost on your computer.
//For example, if I was working on cnn.com, I would change domain.web to cnn.web. For the
//document root I would change domain.com to cnn.com.

<VirtualHost *:80>
	ServerName domain.web
	DocumentRoot /Library/WebServer/Documents/domain.com/
</VirtualHost>

//This is the command line to be used in Terminal.app to restart Apache gracefully.

apachectl -k graceful

Revision: 1113
at September 11, 2006 17:49 by jonhenshaw


Initial Code
//This is the code that goes in the vhosts.conf file (/private/etc/httpd/users/vhosts.conf)
//Substitute domain.web for domain you will use to access the vhost on your computer. For example, if I was working on cnn.com, I would change domain.web to cnn.web. For the document root I would change domain.com to cnn.com.

<VirtualHost *:80>
	ServerName domain.web
	DocumentRoot /Library/WebServer/Documents/domain.com/
</VirtualHost>

//This is the command line to be used in Terminal.app to restart Apache gracefully.

apachectl -k graceful

Initial URL

                                

Initial Description
A great way to work on website in Mac OS X is to set up a vhost. Doing so is very easy. In System Preferences click on Sharing and then make sure you have Personal Web Sharing turned on. Then, open or create your vhosts.conf file (/private/etc/httpd/users/vhosts.conf). Enter the VirtualHost information (see snippet below). The ServerName can be anything and the DocumentRoot should be the path to the folder where you want to build the website. Lastly, open the Terminal and enter the command below. It will restart Apache and will enable your new vhost.

Initial Title
Setting Up A Virtual Host (vhost) on Mac OS X and Gracefully Restarting Apache Web Server

Initial Tags
apache, terminal

Initial Language
XML