Wednesday, August 31, 2011

Using inbuilt Lion web server for web development and testing

This is the first in, what I hope will be, a series of blogs about Web Development on your Mac.

If you are a Mac user like me, you may already know that Mac OS X has an inbuilt web server (based on Apache) that can be used to host personal web sites.

By default, the inbuilt web server is turned off.  To turn it on go to System Preferences > Sharing and check the "Web Sharing" option.  The information displayed will tell you the address of your web server's home page.  There are usually two: one for the machine e.g. http://[your Mac's name]]  and  one for your user name e.g.  http://[your Mac's name]/~[YourUserName]

Click on the links to see the home page for each addressor on the "open..." buttons to see the Folder on your Mac where the root directory is for each site.

For your personal site you should see something like this (see below right)

I am going to use my personal site e.g. the one for my user name (rather than the one for my Mac) as the focus for this blog and the ones to follow.

To make it easier to work with the files in your web site's Folder, open the appropriate Folder and drag it to your Finder's favourites.  Now you'll be able to access the root folder easily any time you need it.

If you have a Web development tool e.g. RapidWeaver, you can now publish web sites to your personal web server.

I recommend creating sub folders in the root directory of your personal web site e.g. http://[your Mac's name]/~[YourUserName]/[someSiteName]

That way you can publish and test multiple web sites at the same time and they won't interfere with each other.

That's a start! In the next blog I will tell you how to tweak your underlying Apache web server settings to install things like PHP and MySQL.

Thanks for reading! Please feel free to post any questions or comments you may have and I'll try to get back to you as soon as I can :)

No comments:

Post a Comment