2 Guys, a Mac, and a Website - The Evolution of the Web - Walk-Through: Publishing Your iCal Calendars Locally
November 8th - Hey, happy pantsday.
2 Guys Store

120x60

 Search

 Classic 2 Guys
10 Random Stories:
Welcome to BatMUD, Online Since 14th, April 1990!
2 Guys Ditches the Dells and is Back to the Mac
Game Review - GL Tron
Defending iTMS
New stuff at the Apple homepage! New stuff at the Apple homepage!
Find your serial number quickly...
New PowerMac prices? That's crazygonuts!
Review: iPod Mini case by Otter Box
Apple Remote Desktop
How To Run Software Update Remotely.

 Comments
yum hot guys - core
You guys are the pants! - PHP WannaBe
Maybe they don't like you - so they sent you defective product. Have yo... - DJLC
A friend of mine had this product, and the antenna portion quickly came... - Cubist
And the other rule of not commenting on your own article!
...
- Jonahan


 Account
Not logged in.

Username:
Password:
Save password
Not registered?




There are no comments to display.

This article is archived, so you may not comment on it.

(The good news is there's always the shoutbox, the forums or the contact form if you're socially-inclined at the moment!)


iMac G5_468x60
 Walk-Through: Publishing Your iCal Calendars Locally
Page 1, Page 2, Page 3

iCal is a pretty slick program. It can be used for all kinds of neat things, including publish your calendars on the web. By default this is set up to use your .mac account, but if you don't have a .mac account, or if you want more control over your calendar (such as password protecting it), you can publish calendars to any web server that has WebDAV running on it. But that is a problem, since there are not very many servers, that people would have normal access to, that run WebDAV. (A standard used to save data to web site (as opposed to just reading it from a site).)

But if you have Mac OS X 10.2 or newer, then you are in luck. Mac os X has always included a very powerful web-serving application, or Daemon, called Apache. Apache is used by most websites, and is very flexible. 2GAMAAW uses Apache to run our site on an old iMac. One of the many things Apache can do is provide WebDAV services.

To host your calendar on your Mac, all you need to do is turn on Apache, and Start the WebDAV service, and enable httpd authentication (if you want to password protect your calendars). Then install PHP, PHPiCalendar, and iCal. Plus you may want to setup a dynamic domain name, so you don't have to remember your IP, or tell others your IP. (a series of 3 sets of numbers divided by periods, ex: 10.344.29.90) This may sound complex, but it really isn't, and I am going to walk you through the entire process step by step. And the best part of all this is that it is completely free.

There are a few things you need before you can start this process. A Mac running OS X 10.2 (Jaguar) or higher, and an administrative account and password. Also, in order to be effective, you will want a connection to the internet that is always on, preferably a broadband connection. (cable, DSL, T1 ect.)

Starting Apache, and WebDAV

The very first step is to turn on the apache daemon. This is a very simple step.
1. open "System Preferences"
2. Click the "Sharing" Preference pane
3. Under the "Services" Tab, put a check in "Personal Web Sharing"

This will start apache, and it will take a second but when it is ready the Message "Personal Web sharing is on" will appear to the right of the window. To verify that apache is running, open up Safari (or whatever web browser you use) and type in the address bar, without the quotes "127.0.0.1" (127.0.0.1 is a special address that will always point to your computer, it's kind of like a second IP that is always the same.) and as long as you haven't changed the website files on your computer, you should see The message: "If you can see this, it means that the installation of the Apache web server software on this system was successful. You may now add content to this directory and replace this page." Now you have the most powerful web serving daemon available, running on your Mac.

The next step is to enable the WebDAV service. This is much trickier than just starting Apache, but just follow my steps, and you'll be fine. Remember that almost everything in OS X terminal is case-sensitive, so be careful to type in command exactly as they are posted. Also, since we are changing this config file, it's a good idea to make a back-up of it. So we'll do that first.
1. Go to the Desktop.
2. Click "Go" at the top, and choose "Go to folder".
3. Type in /etc/httpd/ and hit "Go". (This will open a finder window to that folder)
4. Control Click on "httpd.conf" and choose copy.
5. Close the httpd window, and control click on your desktop, choose "Paste". (this will create a copy of the configuration file on your desktop. You can now move that file to anywhere you want to keep it safe.)


Now we edit the configuration file.

1. Open Terminal (/Applications/Utilities/)
2. Type in "cd /etc/httpd/" and hit return. (This will change your directory to the httpd directory in the etc directory, since we started the path with a single forward slash, that means root of the hard drive)
3. Type in "sudo pico httpd.conf" and hit return. (This will open the file httpd.conf in the text editor "pico", and since we started the command with "sudo" it will open it with root privileges)
4. Since we used "sudo" it will ask for your password. Type in your (admin) account password, and hit return.

This will open Apache's configuration file. This is where you can really make Apache do what you want it to do. In this case, we are going to get it to enable the WebDAV service. The first thing we are going to do is un-comment the following two lines: "#LoadModule dav_module libexec/httpd/libdav.so" And "#AddModule mod_dav.c". (Comments are denoted by the "#" before the command, so we will be taking these #'s out). To do this, follow these steps.
1. Hold down "Control (ctrl)" and hit the letter "w" on the keyboard. (This will bring up pico's find command)
2. Type in "dav_mod" and hit return. Now the cursor will be on the d in dav_mod, on the line "#LoadModule dav_module libexec/httpd/libdav.c"
3. Using the left arrow key, and not your mouse, move the cursor to just to the right of the "#" symbol.
4. Hit the "Delete" key. This will un-comment this line, so that when Apache starts, it will load this module.

Now we have to do it again for "#AddModule mod_dav.c".
1. Hold "control (ctrl)" and hit "w" again.
2. Type in "dav.c" Now we will be on the "#AddModule mod_dav.c" line
3. Move the cursor with your left arrow key to just to the right of the # symbol.
4. Hit the "Delete" key.

Now we have to add text to the file. First find the line that says "<Directory "/Library/WebServer/Documents">"
1. Hold "Control (ctrl)" and hit "w"
2. Type in "<directory " " (type in that one single quote after directory) This will take you to this line: "<Directory "/Library/WebServer/Documents">"
3. Using the up arrow key, go up to the first blank line directly above that line. (There will be a couple commented lines, with a # symbol at the beginning.)
4. hit "Return" twice to move the rest of the text down a couple lines, and then hit the up arrow once. (This will help with the format of the config file, so it is easier to read.)
5. Paste in the following text:

#
# Settings for WebDAV Server
#
DAVLockDB /Library/WebServer/DAVLock/DAVLock
DAVMinTimeout 600
DAVDepthInfinity On
<Directory /Library/WebServer/Documents/DAVdocs>
DAV On
AllowOverride AuthConfig
AuthName "DAV Restricted"
AuthType Basic
AuthUserFile /Library/WebServer/users
<Limit PUT POST DELETE PROPFIND PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
Require valid-user
</Limit>
</Directory>




Now we are done editing the Apache Configuration file, so we need to close and save it.
1. Hold "Control (ctrl)" and hit "x"
2. It will ask you if you want to save it, hit "y" for yes.
3. It will ask the name you want to use, Leave it as it is, and hit "Return".


Now you will be out of "pico" and back in the terminal ready to type in commands. What we have to do now, is create a couple folders for WebDAV, and a user account for WebDAV so that people have to authenticate to store stuff on your WebDAV server. To do this, follow these steps.
1. Type in "cd /Library/WebServer/Documents" (This will change the directory you are in)
2. Type in "mkdir DAVdocs" (This will create a directory called DAVdocs)
3. Type in "sudo chown www:www DAVdocs" (This will change the owner and group to www for the DAVdocs directory)
4. Enter your password if asked.
5. Type in "cd .." (This will move you back to the WebServer Directory)
6. Type in "mkdir DAVLock" (This will create a directory called DAVLock)
7. Type in "sudo chown www:www DAVLock" (To change the user/group on this one too)
8. If it asks for your password, type it in.

Now we need to create a user so that WebDAV will require authentication.
1. Type in "sudo htpasswd -c users username" Change "username" to whatever you want your username for WebDAV services to be. (This will create a password file for that username)
2. if it says "password" it needs your password first, (it may not ask for it) if it says "New Password" then it is asking for the password for the username you are creating. (It will ask for "New Password" for sure, but it may, or may not ask for "Password".
3. Then it will ask you to "Re-type new password", so re-type that password for this username account.


Now we have to create a file that will tell apache we want to require a password for anyone to connect with a WebDAV client. To do that, we need to create a file called .htaccess with certain code in it.
1. Type in "cd /Library/Webserver/Documents/DAVdocs/"
2. Type in "sudo pico .htaccess" (since .htaccess doesn't exsist, this will create a file called .htaccess when we save it.) Put in your password if it asks.
3. Paste in the following text:
AuthName "DAV Restricted"
AuthType Basic
AuthUserFile /Library/WebServer/users


require valid-user

4. Hold "Control" and hit "x"
5. Hit "y"
6. Hit "Return"


Now that we have activated WebDAV, we need to restart Apache. There are several ways to do this, but we are going to do it the nerdiest way, the command line way. (since we are already in terminal).
1. Type in "sudo apachectl graceful restart"
2. Type in Password if it asks for it.


If you got everything correct, you will see the message:

"/usr/sbin/apachectl graceful: httpd gracefully restarted /usr/sbin/apachectl restart: httpd restarted"

after you type in your password. If you see this, everything is working fine, if you see an error message, go back over my instructions thus far, and double check everything.

If you do get that message, test WebDAV, to do that, open Safari, and type in the address "127.0.0.1/DAVdocs/". It should ask for your username, and password, if it does, and your username and password work when you type them in, then you are set. If it doesn't work, then you should double check the directions thus far.

Page 1, Page 2, Page 3

January 8 2004, 10:51 AM EDT, by




Comments:
MacMini_02

 Site Links
 Deep Thoughts
Who are stupid people? When you call someone stupid, have you ever wondered who THEY call stupid?

 Around Da Web
iProng:
iPhone steals show at CTIA Wireless 2007
DLO offers dual cover fashion case for iPod
AT&T received 1M inquiries on iPhone
MacDailyNews:
Ars Technica in-depth review: Apple TV ?impressed all those who touched it?
Inside Apple?s Mac OS X 10.5 Leopard Server OS
The chips inside Apple TV
Think Secret:
Adobe Creative Suite 3 pricing revealed
 Olde Stuff
2 Guys Podcast Feed
Greatest American Hero
iAir
Scary Ballmer
Space Game
 We Like:
 • 2 Guys
 • Apple.com

 Side Projects
Jonahan
  • JediPoker.net
  • Jonahan.com
  • iProng
  • MacProng
iKen
  • MacIdiot
Jedbeck
  • Jedbeck.com
J.P.
  • Baby Ashley Project