How to Run a Free Web Server From Home on Windows or Linux with Apache

Jan 3, 2012 11:26 PM

Paying for web hosting isn't ideal in most situations. If you have your own website, hosting it yourself is very acceptable and easy to do, assuming your internet bandwidth permits. Most people want to run a personal site, nothing crazy, so hosting from home on low-bandwidth internet is actually a better solution in most cases.

In this Null Byte, I'm going to show you how to set up your own web server from home using the free Apache web server. You can be running Windows or Linux, because I will be covering them both!

Requirements

  • A website to host (for testing purposes, not really needed if you just want to learn)
  • Windows or Linux

Enable Port Forwarding

First, let's set up port forwarding so that you can access your website from an external network.

  1. Click Start.
  2. In the search, type cmd and hit Enter. In the prompt, type ipconfig, and it will list your default gateway and IP address. Take note of both.
  3. Type 192.168.1.1 or the gateway you got from the previous step into the address bar of your internet browser.
  4. Log into your wireless router. Default username and passwords are usually admin:password.
  5. Click Port Forwarding somewhere on the page. All of them look different, but here is how mine looked:Mastering Security, Part 2: How to Create a Home VPN Tunnel
  6. Click Port Forwarding on the router page.
  7. Set the host to your computer's IP address that we noted, and the port to 80.
  8. Go to What Is My IP Address and write down your IP. You will need this for reference later, as well as during the Windows install of Apache.

Register with DynDNS

DynDNS will allow us to have a domain to visit and remember for our webserver, rather than remembering our dynamic IP all of the time. Simply sign up for the service and fill in your IP, it's really straightforward.

Install the Apache Web Server

Follow the instruction set that corresponds to your platform.

Windows

  1. Download the latest release of the Apache web server with an .msi extension.
  2. Run the installer.
  3. When presented with the option, make sure to install the Apache service.
  4. Open a command prompt and navigate to the Apache bin directory under C:\Program Files\Apache Group.
  5. Run the service.

        httpd -k start

Linux

  1. Run your package manager and install Apache. I run Arch, so here was what I input:

    sudo pacman -S apache
  2. Run the service.

        sudo rc.d start apache
  3. Visit 192.168.1.1 to see the Apache test page.
  4. To add your website to your server, just put the files in /srv/www/.

There you have it. Better than paying hosting for terrible service! You will also have complete control over your website, so it really benefits in the long run.

Be a Part of Null Byte!

Image via datacenterknowledge

Just updated your iPhone? You'll find new Apple Intelligence capabilities, sudoku puzzles, Camera Control enhancements, volume control limits, layered Voice Memo recordings, and other useful features. Find out what's new and changed on your iPhone with the iOS 18.2 update.

Comments

No Comments Exist

Be the first, drop a comment!