The first installment of this series helped you figure out if being your own Web host is for you or your small business. The second installment discussed more or less the technical requirements and considerations. Finally, this tutorial will help you install and configure the Apache Web server, whether you’re running Windows or Linux (Ubuntu or other distributions), or even a Mac.
Methods for Installing Apache
So you decided to host your own Web server, and you’ve chosen Apache. Next big decision: What’s in your AMP stack? This article steps through the installation and configuration process.
When installing Apache, you can install either just the Web server application (and other components separately as needed) or a Web server software distribution or package. We recommend using packages for small business or personal solutions, as it eases the task of the server installation. Many packages exist that wrap or stack scripting languages (such as PHP and Perl), database and other servers (such as MySQL, FTP, and e-mail), and configuration GUIs into one installation program.
When scouring the net, you’ll find these Web server packages have acronyms with AMP as the base letters, standing for Apache, MySQL, and PHP (or Perl or Python). To complete the acronym, a preceding letter identifies the supported operating system. For example, you’ll see WAMP packages that install on Windows, LAMP for Linux, and MAMP for Macintosh. You may also see other creative acronyms such as XAMPP, where the X means cross-platform and the extra P for the Perl scripting language. Basically, package developers just make up the acronym based on which components are in the packages.
Some examples of WAMP packages include Apache2Triad, EasyPHP and WAMP Server. There aren’t many real LAMP packages you download and install, rather, some Linux platforms (such as Ubuntu Server Edition) include a LAMP option during the OS install that will help automate the configuration of the components instead of having to install each separately. Cross-platform packages such as XAMPP are installable on just about every OS. A MAMP package is available from living-e AG.
Note: Make sure the package you use is for production use, if you want to use it for a public Web site. Some packages, such as XAMPP, are for developer use only, such as when testing local Web applications. These types of packages have security components missing that would otherwise be included if it were for regular Web sites.
Installing Apache2Triad on Windows
Unsure About an Acronym or Term?
To download the Apache2Triad Web server package, you can go to their SourceForge site. After the download is complete, open the installation file. The installation is painless. Among other things, you’ll specify the password you want configured for access to the admin screens of the server components. Just sit back and relax while it’s all installed. During the post configuration, many DOS Prompt windows will open. Except when prompted to enter the Apache2Triad password you created, don’t mess with any of the DOS windows; let the package do its work. Once everything is completed, you’ll have to reboot your computer.
Installing LAMP on Ubuntu Server Edition
As discussed earlier, one option to obtain Apache, MySQL and PHP is to use Ubuntu Server Edition. Installing LAMP is achieved when selecting the LAMP server option during the installation of Ubuntu Server Edition. This option appears on the Software Selection page that comes after the partitioning and formatting process. During the installation of the MySQL database server, you’ll be prompted to create a password for the “root” user; make sure you specify one.
Testing the Web Server
After installing the Web server package, you can test to see if the server is working correctly. Simply enter the word localhost (or the IP address of 127.0.0.1) into a Web browser on the host computer. To test from another computer on the local network, use the IP address of the computer hosting the server, for example, 192.168.1.105. If all went as planned with the Apache2Triad installation, you should see an index or listing of the default folders. If you went the LAMP route during the installation of Ubuntu Server Edition, you should see the “It works!” page.
Configuring Your Firewall
Before your Web site is accessible from the Internet, you have to configure your firewall to allow the Apache Web server traffic through port 80. This is required because firewalls block requests from the Internet (port 80). Opening up the port will allow people on the local network and Internet visit your Web site. (You must also configure your router for your site to be accessible over the Internet, which is discussed in the next section.) If using Windows, you must add the following program to the exceptions list:
C:Program FilesApache Software FoundationApache2.2binhttpd.exe
Don’t forget about any third-party firewalls you have installed on Windows or Linux: You must other servers, such as for FTP or e-mail, you must open up the appropriate ports for those as well on your firewall program(s). FTP, for example, uses port 21, and e-mail servers use ports 25 and 110. Either input these port numbers into the firewall program or add the program itself to the exceptions or authorized list.
Configuring Your Router
If your host computer is not directly connected to your Internet modem, but through a router, you must configure your router to forward the Web traffic to the computer on which you’ve set up the Web server. This is because when people try to access your Web site from the Internet, the request comes through your Internet modem and then to your router. Unless you tell the router where the server is on your network, the router won’t forward the Web site requests on any further.
The IP address of the host computer must be a static (or permanent) IP address on the local network. By default, all routers come with DHCP enabled, which gives out temporary IP addresses to clients and computers that change periodically. Therefore, before telling your router the address of your host computer, you must give the network adapter of your host computer a static IP address. This ensures the router always forwards the Web traffic to the correct IP address for the host computer.
Tip: Some routers have a static DHCP or DHCP reservation feature, configurable from their Web-based configuration utility. This type of feature lets you tell the router to always give a certain client or computer a particular IP address. This achieves the same thing as going the traditional route of configuring a network adapter with a static IP address on the computer itself.
After configuring the host computer’s static IP address, you can set up the router to forward to it. You want to login to your router’s Web-based configuration utility and find the appropriate screen, usually labeled Virtual Server or Port Forwarding. Using the given controls, specify to forward Port 80 to the IP address of the host computer.
Again, don’t forgot about any other servers (such as FTP and e-mail servers) you want to be accessible from the Internet. You must forward the appropriate port(s) for these other servers to the IP address of the host computer.
Accessing Your Site from the Internet
Now your servers should be accessible from anywhere in the World. If you properly configured your server, firewall program, and router, you should always be able to bring up your home page (or the Web server’s default page) by entering in your Internet IP address into a Web browser. Remember, this is the IP address assigned to the Internet connection at your home or business where the host computer resides. This is not the local IP address of your router or host computer, such as 192.168.1.1 or 192.168.1.105.
If you’ve set up a host name (such as from DynDNS, NoIP.com or FreeDNS, as discussed in the previous part of this series, you can type it into a Web browser for easier access to your Web server.
Stay tuned — the next installment will help you configure and manage the servers. In addition, if you purchased a domain name, you’ll discover how to make it work with your own servers.
Eric Geier is the Founder and President of Sky-Nets, Ltd., a Wi-Fi Hotspot Network. He is also the author of many networking and computing books, including Home Networking All-in-One Desk Reference For Dummies (Wiley 2008) and 100 Things You Need to Know about Microsoft Windows Vista (Que 2007).