HOST YOUR 1 OWN WEBSITE

RECYCLE AN OLD MAC BY USING IT AS A HOME WEB SERVER AND TEST MACHINE

Not long ago, the idea of hosting your own website from home would have seemed hopelessly optimistic. Ten years back, most of us went online using dial-up—a painfully slow technology that made home-hosting impractical.

It wasn’t only the hardware that put a damper on things, either. The software that underpins a home server was both expensive and tricky to manage.

How things have changed. Always-on connections are widely available and relatively cheap, and you can recycle an old Mac for use as a home server with some free or low-cost software. It takes a couple of hours and very little in the way of expertise, thanks to some well-thought-out routines and a lot of automation.

It’s a great way to set up a staging server for testing web pages before you upload them to a live site, or for hosting photos and movies to share with friends and family. It’s possible to host a regular blog or public website from a Mac, too, but unless you expect a very low-traffic site, it might be better to stick with a commercial web host. Every visit to your home server would eat into your monthly download allowance if you’re in a capped service, and worse, should your site become popular, you’ll be sharing your outgoing broadband connection with all of those inbound connections. Under that kind of load, even super-fast broadband shows the strain. So, what are your options?

HARDWARE

You needn’t spend a lot of money to get yourself started. The simplest solution is obviously to buy a Mac mini server, but that starts at $1,300 and still needs to be configured when you get it home. It’s an entirely uneconomical proposition for small-scale hosting when you could sign up to a regular hosting deal for $75 a year. At that price, you can host your site for nine years before you’ve spent more than the cost of the Mac mini, benefitting from remote backups and technical support along the way.

An old or second-hand Mac is a far better option. If you want to host your site on OS X Server (see p51), which isonly available as a download from the Mac App Store and requires Mountain Lion, you need an Intel-based Mac. The oldest compatible machine is now the mid-2007 iMac (model numbers MA876LL, MA877LL, or MA878LL). At the time of writing you can pick one up on eBay for around $450. If you want to save space by using a Mac mini, which is easier to tuck into a corner or under a bed, you need the early 2009 model (MB463LL/A or MB464LL/A) or later. These are the fatter minis with the white top and slot-loading SuperDrive, which you can pick up for around $400. You can find the full system requirements for Mountain Lion at http://bit.ly/ML_OSXrequirements.

You don’t need to connect a monitor to the mini once it’s up and running, as you can administer it remotely either by installing the Server application on a second Mac or by using Screen Sharing (connect to the server by switching to the Finder on another Mac on the same network, pressing command+K, and entering vnc:// followed by the server’s IP address on your network in the dialog). If all you see is a black screen, it’s likely that your mini isn’t running the correct graphics drivers to fully access the integrated GPU (Graphics Processor Unit). You can fix this by fooling it into thinking a monitor is directly connected by hooking up an inexpensive Mini DisplayPort-to-DVI adaptor to the port in the back of the Mac. You can pick up one on eBay for around $10.

SETTING UP YOUR NETWORK

We’ll cover the software options on the following pages, but before going any further, you need to make your server visible to the outside world.

Every computer on the Internet is given a unique numeric identifier called its IP address. On a home network, this address is assigned to the router, which then distributes other numbers on its internal network to each of the connected computers, including your server. This introduces two problems.

First, because your server’s internal number isn’t visible to the web (it’s blocked by the router) we need to somehow redirect traffic to it once a visitor arrives at your router. Second, because almost all consumer broadband deals are assigned what’s known as a dynamic IP address, the router’s identifier changes over time, so we need to link your ever-changing numeric identifier to the domain name people will type in when they want to visit your site.

Starting with the former, assign your server a fixed address on your internal network. To do this, use your server machine to open the Network pane in System Preferences. Click Advanced, followed by TCP/IP, and make a note of the values beside IPv4 Address, Subnet Mask, and Router. Change the Configure IPv4 drop-down menu from Using DHCP to Manually, and then re-enter the values you copied down in the boxes below. Save and exit the Preference pane.

CONFIGURE YOUR ROUTER

Now, fire up your browser and type in the numbers you copied from beside Router in System Preferences, to access your router’s configuration pages. The process from this point on varies from router to router, but look for an option for either Port Forwarding or Virtual Servers. This part of the router configuration screens tells it how to direct specific types of incoming traffic—in this case, requests for web pages—to a particular machine on your network. Some routers greatly simplify this process by allowing you to choose the traffic type from a drop-down menu. If yours does, choose HTTP or HTTP Server. If you instead have to enter port numbers, specify port 80 for both the start and end ports. If your router offers a second menu beside this one from which you can choose the machine to send that traffic to, pick your server. If it instead asks for an IP address, enter the value you copied from the IPv4 Address line in System Preferences. Save the configuration and, if it requests it, allow your router to reboot. It now knows where to find your hosted site on your local network; we just have to tell the wider world how to find the router itself.

This is handled by a dynamic IP update service. There are several to choose from, but No-IP (http://noip. com) is one of the easiest to work with, and offers a free option if you’re happy to use a subdomain.

Sign up for a free account and then click Add Host to claim your domain. Enter your chosen subdomain in the first box of the form and then choose a parent domain from the drop-down menu. For example, if you wanted to set up maclife.bounceme.net, enter maclife in the first box, and pick bounceme.net from the drop-down menu. Leave Host Type set to DNS Host (A) and then click Add Host at the foot of the screen.

SQL - 17 | 0,534 сек. | 7.4 МБ