[an error occurred while processing this directive]
[url] rasterweb.net/raster/
[email] pete@rasterweb.net
[pgp key] public key

RasterWeb [More Info]
Home
About
Contact
Archives
Search
Mobile Edition
Kids
Misc
Rambles
Computers
Code

Code:
Code contains bits of text that are probably more interesting to computers than people...


[RasterWeb]

This is a simple guide to setting up your Mac to use as cgi development machine without having to be connected to the internet, or any network.

You might also try this page at Apple and this one : setting up a web server on your mac

You basically trick your Mac into thinking it's on a network and has a valid IP address, once that's done, you can run a web server and browse your own mac, including running cgi's. I'm using Mac OS 8.1, although I've also done it with some version of 7.5 long ago. You do need to be running Open Transport.


The TCP/IP Control Panel

Here we see the TCP/IP Control Panel set up for local access.

Make sure the Connect via: pop-up is set to AppleTalk (MacIP) and you can just leave the MacIP server zone: set to current AppleTalk zone as we're only using our own machine. We can put in any number since we're manually choosing an IP address. Normally you'd get a different IP number everytime you dial up to your service provider. (Here I put in 1.2.3.4 It has to be at least *somewhat* valid! ;)

[note: I've been told that 127.0.0.1 is the 'preferred' and 'safe' address, as it is normally the loopback address, meaning it will look towards the machine itself first. If you're not connected to the net though, use what you want, I for instance at home I use the same IP my office machine has...]

Once this is done close the TCP/IP Control Panel. It might be a good idea to save this configuration. I called mine Local.

You also need to set your AppleTalk Control Panel to "Remote Only" so make sure you've loaded the ARA software, which has the "Remote Only" Extension...

Serving It Up!

From here you need a web server. There's NetPresenz, QuidProQuo, WebStar, etc... you can use what suits you. For my purposes Apple's Web Sharing does the job. It's small and simple. It does lack features such as Server Side Includes, but it uses a pretty small amount of RAM, is easy to configure, and probably came with your system. I've got one Mac that I just leave it running on all the time since it's a Control Panel. But again, use what you like.


The Web Sharing Control Panel

If you're still using Web Sharing 1.1, update it to 1.5. Here's the url for the update: http://asu.info.apple.com/swupdates.nsf/artnum/n10773

Once you've got Web Sharing installed and running, it should show you the IP address you entered in the TCP/IP Control Panel. If it doesn't, something's wrong. You should also select a home page, if you haven't created one yet, do that now - then select it using the Select... button. I'd suggest 'index.html' or 'default.html'.

Ok, you're browsing! Try it out, you should be able to access the html documents in the folder you specified (in this case we're using the Web Pages folder on the hard drive Mac HD.)

Did I mention you might want to read the documentation that came with Web Sharing to find more info?

It's CGI Time!

Alright, I suppose we *could* use AppleScript for the cgi part, but hey, not everything has to come from Apple! So let's look at MacPerl.


MacPerl's Demo.cgi

If you've got MacPerl, check the application's folder for a folder called MacPerl CGI, and in there look for a file called Demo.cgi. If it's there just copy it into your Web Pages folder, and now try to open it in your browser with the url http://1.2.3.4/Demo.cgi. Ok, what happened? Did it work? Did I mention you should be using MacPerl 5.2.0r4 or later? Did the Demo.cgi script launch, and launch MacPerl in the process?

Ok, then, we're up and running! And it we aren't, please re-read this document, and try it again. I'm pretty sure Web Sharing comes pre-configured with the mime type for cgi's - if not, let me know. It's been a while since I set this all up from scratch.

As usual, comments are welcome: pete@rasterweb.net



[top of page]

  Last Modified: 08.17.2000 by rasterboy