dslreports logo

    All FAQs Site FAQ DSL FAQ Cable Tech About DSL Distance DSL Hurdles »»


how-to block ads

This Section
Mac OS X includes the Apache web server, the most common server software in use on the internet. The Apache web server allows you to have a web site on your computer running OS X that other users on the internet can connect to, just like any other site.

Starting up the Apache web server is trivial: From the Apple Menu, choose System Preferences. Choose Sharing in the window that opens. In the Sharing panel, click the checkbox for "Personal Web Sharing". That's all for the OS X part of the setup.

Next, you'll need to put your website in the correct place on the computer. I will assume that you have a collection of web pages for your site, all ending in ".html" or image files. Constructing these pages is beyond the scope of this article. To place the web pages into the proper place so that Apache can find them, do the following:

    •From the Finder, Choose Go->Computer.
    •Open the disk that is your startup disk (usually named "Macintosh HD").
    •Open the Library folder.
    •Scroll to the bottom and open the Webserver folder.
    •Open the Documents folder inside the Webserver folder.
    •Drag the folder containing your website files into the Documents folder. Make sure that one of the files (the main page) is named "index.html".

That completes the setup for OS X. What Apache will do now is to serve the "index.html" page to anyone on the internet who types the public IP address of your computer into their browser.

But there are a couple of things we have to ensure are set up properly for Apache to be able to do this. First, you have to find out what your public IP address is. If you are NOT using a router, you can find this in the Network pane of the System Preferences. Just give this IP address to people and they should be able to connect.

If you ARE using a router, then things are a bit more complicated: the router gets your IP address from your cable or DSL provider, and then assigns its own "internal" IP addresses to the computers connected to the router. These "internal" IPs begin with either 10 or 192, and they can't be used for other people to access your web server - they need the "public" IP. Here are the details you need for using a router:

    Refer to your router's instruction manual for the IP address of the router's setup page. This is almost always, so type that in and see if you get the router's setup page (you will have to type the name and password of the router to get in - if you have not changed it, it is listed in the manual that came with the router).

    Once on the setup page, you will need to note the "public IP" address that the router says it is using. This is the address that you tell people to use to connect to your webpage (see the last section on static versus dynamic IP addresses).

    Also, check for a section of the router setup page that is named "port forwarding" or similar. This is where you will need to tell the router which one of your computers to send incoming requests that come in on port 80 (websharing) to. The exact way this is displayed varies with the router, but basically you want to set it up so that the router forwards port 80 to the internal address of your webserver machine. Consult your router manual for port forwarding.

Finally, we have to discuss "dynamic" IP addresses. Most cable and DSL providers supply "dynamic" IP addresses, meaning that whenever you turn on your computer or router, it might be assigned a different IP address than it had the last time you used it. This is a problem, if you have told people to use a certain IP address to get to your website and now the address is changed. To solve this problem, you can set up your computer so that it periodically checks to see if its IP address has been changed, and if so, it changes the IP of a website name that you can set up for free at »www.dyndns.org - you will need to install a small software application on your computer, and follow the instructions at dyndns.org for setting up a free account. Once this is done, you will have a name for your computer that you can give to people, and the IP address can change without you having to worry about it. NOTE: many routers have the software application mentioned above already installed in the router. Check the router manual for information on setting this up.

Once you have followed these steps, you should be able to connect to your web server by typing the PUBLIC (not internal) IP address into a browser - if everything is set up correctly, the Apache server on your computer will display the "index.html" page in the /Library/Webserver/Documents folder.

A final note: some ISPs block port 80 so that their customers cannot run a web server - the ISP will have a rule against it in their Terms of Service. If this is the case, you will have to use a port other than port 80, but setting up the server to do that is beyond the scope of this article. Also, running a server when the ISP has a prohibition against it may cause your cable or DSL service to be terminated by the ISP.

Expand got feedback?

by Johnny See Profile edited by rjackson See Profile
last modified: 2005-07-24 23:46:01