Today’s Tuesday Mac Tip is about something I enourage all Geeks to do at one point and time. And Macs are great at it, so without further ado:
Mac OS X comes ready to do web serving right out of the box with Apache, the Internet’s most popular, stable and feature rich web server. Setup takes just a few minutes.
First you need to enable web sharing on the computer. To enable web sharing, do the following:
Login to your Mac with an account that has admin privileges. Select Apple -> System Preferences
Click the Sharing icon
Click the Lock icon and enter your password if necessary Click the Start button under Web Sharing Off. This will start the web server.
Close all open windows Open your web browser
For the Address (URL) type: http://localhost/ You should now see an Apache web page load in your browser.
You can now serve web pages for the machine as a whole and also for individual users.
Web Serving for the Machine
Store your HTML files in /LibraryWebServer/Documents. Access your page in your web browser by enterying http://localhost/ or http://youripaddress/ for the address (URL). Use the IP address method for remotely accessing your pages from across the Internet. (Note: Replace “youripaddress” with your actual IP address.)
Web Serving for Individual Users
Store your HTML files in ~/Site (~ is your home directory) Access your pages by entering http://localhost/~joeuser or http://youripaddress/~joeuser/ (Note: You actually type the ~ here, not like above. Replace “joeuser” with your Mac OS X login account username and “youripaddress” with your actual IP address. See below.)
How to Find Your IP Address To Access Your Site Remotely
Selet Apple -> System Preferences
Click the Network icon
If you are connecting to the Internet with with a modem select Internal Modem from the Configure popup menu. If you are using an ethernet card with a cable modem, select Built-in Ethernet from the Configure popup menu. If you are connected via another method, choose the appropriate option for your network setup. Note your IP Address on the left hand side of the screen. Open your browser window For the Address (URL) type: http:theipaddressyoujustlookedup
You should see the page load.
Note: Most users with dial up/dsl/cable connections to the Internet have dynamic IP addresses. What that means is that each time you connect your Internet Service Provider (ISP) gives you a different IP address. So for someone to access your web site you would have to tell them your IP address each time you logged onto the Internet. Not very practical! To solve this problem you can contact your ISP and request a “static IP address”. They might charge you a bit more per month, but you would then be able to host a site on your local machine. Of course, if you don’t want to pay the extra money, or don’t want you computer connected to the Internet all the time, you could register a domain name and pay someone to host your site for you. Then you could use your local web server when you are building and testing your site before you transfer it to your web hosting provider’s server.
Well that will about do it, good luck in your webserving adventures and as always you can email me or post it in the forums-
-b
Name (required)
Mail (will not be published) (required)
Website
No Comments to “Running A Webserver (Mac Tips)”
Please Wait
Leave a Reply