Set up a basic website with Apache

Here are instructions on getting your small business website up and running with Apache on Linux or Windows.

Apache is the most widely used web server on the planet -- and with good reason. Not only is Apache flexible and powerful, but it's also quite easy to get running and to start serving up content.

The idea of using a web server that relies so heavily on the command line and flat text file configuration might be rather daunting, but it doesn't need to be. I'll walk you through setting up a basic website with the latest iteration of Apache on Linux or Windows (I'm assuming you have a Linux or Windows machine ready for the task). After you follow this tutorial, you'll have either a Windows, Apache, MySQL, PHP (WAMP) or a Linux, Apache, MySQL, PHP (LAMP) server running and a "Hello World" page greeting your users.


There are lots of WAMP servers you can install to get your Windows-based Apache server set up, but my favorite is the WampServer package, which installs everything you need for a web development environment. Here's how to install WampServer.

  1. Download the WampServer installer.
  2. Double-click the installer to start the process.
  3. Walk through the user friendly installer wizard (it's a typical Windows application installation).

Once the installation is complete, you should see an entry for WampServer in your Start menu's All Programs section. In that menu, click the start WampServer entry. When the WampServer starts, left-click the icon in the System Tray to see the menu (Figure A); from this menu, you can start or stop the services and gain quick access to the server's configuration files. 

Figure A


The WampServer menu.

To get your website set up and running, the most important information you need is:

  • Document Root: This is where your website files will live. For the WampServer, these files will be in C:\wamp\www.
  • index.html: This is the most basic page for your website and should reside within the Document Root.

By default, WampServer will use the index.php file for its default page. Within the C:\wamp\www directory, rename the index.php file to OLD_index.php. In that same directory, create the index.html file and put this single line in the document:

<h3>Hello world!</h3>

Save that file and make sure your WampServer is running. Open your web browser and point it to the address of your WampServer. You should see the text (in bold):

Hello world!

If you do, congrats! Your WampServer is up and running.


I'll demonstrate how you can have a full-blown LAMP server up and running with just a couple of commands. For simplicity sake, I'll be demonstrating this on a Ubuntu 13.04 server. Here are the installation steps.

  1. Open a terminal window.
  2. Issue the command sudo apt-get install tasksel.
  3. Type your sudo password and hit Enter.
  4. Accept the installation.

After tasksel completes the installation, go back to the terminal window and do the following:

  1. Enter the command sudo tasksel.
  2. In the resulting window, use the down arrow key and move to LAMP Server (Figure B).
  3. Press the Tab key to move down to OK and hit Enter.
  4. When prompted, enter the passwords for MySQL.

Figure B


When this installation completes, your LAMP server will be running.

What you need to know:

  • Document Root: /var/www/
  • Index: The LAMP defaults to index.html for its main page. You can edit that page directly for your website.
  • To start and stop Apache, issue these commands: sudo apachectl start or sudo apachectl stop.

Congratulations! You now have a web server. I bet you had no idea setting up Apache for simple web pages was that easy.

Keep in mind that Apache isn't limited to basic web pages; it's also just as easy to serve up robust and dynamic sites with this powerhouse server. 

Also read: 8 tips to make SMB websites better