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.
- Click Start.
- 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.
- Type 192.168.1.1 or the gateway you got from the previous step into the address bar of your internet browser.
- Log into your wireless router. Default username and passwords are usually admin:password.
- Click Port Forwarding somewhere on the page. All of them look different, but here is how mine looked:
- Click Port Forwarding on the router page.
- Set the host to your computer's IP address that we noted, and the port to 80.
- 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
- Download the latest release of the Apache web server with an .msi extension.
- Run the installer.
- When presented with the option, make sure to install the Apache service.
- Open a command prompt and navigate to the Apache bin directory under C:\Program Files\Apache Group.
- Run the service.
httpd -k start
Linux
- Run your package manager and install Apache. I run Arch, so here was what I input:
sudo pacman -S apache - Run the service.
sudo rc.d start apache - Visit 192.168.1.1 to see the Apache test page.
- 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
Comments
No Comments Exist
Be the first, drop a comment!