How to Host Your Website on Your Own Server [Apache]

how to host your own website and domain images
how to host your own website and domain images

Looking to host your website on your own server?

After creating your website, you need to host it on a web server connected to the Internet.

A web server is a program installed on a computer that allows people (your website visitors) to access your website through their browsers.

This page you are viewing currently, for example, is downloaded from a remote server at 1and1 web hosting service.

Physically, web servers are rectangular-shaped box, just like a Encyclopedia, stacked on top of each other. They look scary and are a bit noisy.

Often, you’ll see them stored in a cool place of a window-less room.

But, did you know you can also host your website on your own home server?

Why create your own server at home for web hosting, you ask!

Maybe, you want to download files stored on your home computer from anywhere. You may want to share your music or movie collections with your friends and listen or watch together when you’re hanging out together.

In this situation, hosting your own website on your computer is a GREAT IDEA.

In this post, I will show to host your website on your own server, step by step. With the right password, anyone can connect to your home computer and download movies or music directly from it.

But, setting up your own web (home) server is NOT an easy task. There are several things you need to consider to know whether is it a good idea to host your own web server on your home. (Check out my article on 6 things to consider before you host your website on your own server.)

Quick note: Hosting your website on your own server is not secure. Before you begin, remove spyware and virus from your computers and ensure latest security fixes and patches are updated.

This guide is meant for expert users who are comfortable editing their “config files” and exposing their port 80 on their home computer to the rest of the world. We also recommend you to place a strong firewall with explicit user-set rules.

So, if you’re ready, here’s what you will require to begin:

  1. A computer running on Windows
  2. An Internet connection
  3. A Web Server (Apache Server) installed on your computer

One you have these basic things, you’re ready to host your website on your own server.

How to Host Your Own Website and Domain (Step by Step Instructions)

Step #1: Installing Apache Web Server

a) Before doing anything else, close all the firewall or server apps that you may be running on your computer (Windows Firewall, Skype, Trillian and other instant messaging apps.) If you don’t close these programs, the server installation and configuration won’t work for you. After installation and configuration, you can always re-start and use these programs.

b) Download the latest version of Apache HTTP server from this link.

c) Click on the setup icon to start the Installation Wizard.

d) Accept their license agreement and specify the default folder where Apache files will be stored, like:

C:\Program Files\Apache Software Foundation\Apache2.4\

e) Enter your email address and IP address of your local computer (127.0.0.1) as the domain name information in the screen that asks you for server information.

f) To complete the installation wizard, use the “Typical Installation” setting.

g) Open your browser and type http://localhost.

If you see a message that reads, “If you can see this, it means that the installation of the Apache web server software on this system was successful,” then congratulate yourself – you’ve successfully installed Apache web server on your home computer.

Step #2: Configuring Web Server for File Sharing

Okay, let’s say you want to grant access to a folder named “my movies” on your home web server, and the movies are located at C:/Aby/My Movies.

a) Open the following file using notepad.

C:\Program Files\Apache Group\Apache2.4\conf\httpd.conf

It is an Apache config file. You won’t understand what there is, but you only need to change a couple of things, and the rest, you can ignore.

b) In this httpd.confi file, comment out the line that says DocumentRoot, like this:

#DocumentRoot “C:/Program Files/Apache Group/Apache2/htdocs”

c) On the next line, add the path to your movie directory, like this:

DocumentRoot “C:/Aby/My Movies”

d) Next, comment the line that says <Directory “C:/Program:

#<Directory “C:/Program Files/Apache Group/Apache2/htdocs”> 

e) And, in the next link, insert the following code given below:

<Directory “C:/Aby/My Movies”> Lastly, just about 20 lines from here, replace: AllowOverride None 

With:

AllowOverride All

f) Once you’re done, save the file.

g) Restart your Apache web server to see the changes take place.

h) To restart, click on the Apache server icon on the taskbar, and hit the “Restart” button.

At this stage, if the Apache web server restarts, then know that you’ve properly configured the server.

i) All you have to do now is to open your browser and type http://localhost/.

You should see a list of movie files on your home web server. Isn’t that wonderful?

Step #3: Password Protect Your Web Folder

If your web server folder is not protected, anyone can access it. Your resources – web space, RAM, and bandwidth – are valuable, but they are also scarce and vulnerable to outside threats. It is your duty to make your web folders as secure as possible.

This is why you need to password protect your folder on your home server.

a) For this, open the command prompt:

Click Start menu, select Run, and type “cmd”,

b) Change the current folder to Apache bin folder (directory), like this:

cd “C:\Program Files\Apache Software Foundation\Apache2.4\bin”

c) Next, create a password, like this:

htpasswd -c “C:\Documents and Settings\Aby\my_password_file.txt”

d) Replace the path to the “my_password_file.txt” to the actual path of your new password file, (which must be outside the Apache root server folder).

Of course, replace “aby” with your own username.

e) When prompted, enter the password you want to create.

g) After this, log in to your movie directory by opening a new file using Notepad, and copy paste the following code there.

AuthType BasicAuthName “Login first to access this page…”  

AuthUserFile “c:\Documents and Settings\Aby\my_password_file.txt”AuthGroupFile /dev/null  require valid-user

Make sure you’ve replaced the username and password with your actual login details. Save this file in your web server root folder (C:\Aby\My Movies) as “.htaccess” (do not forget to type “.” in the beginning.) The file is stored as C:\Aby\My Movies\.htacess.

*Note: If you use Notepad to create your .htaccess file, when saving your file, make sure to put quotes around the filename – such as “.htaccess” – so that Notepad recognizes it as .htaccess rather than a .txt file.

If you save your file having “.txt” as a file extension, then it won’t work!

h) Now, open your browser, and type http://localhost/. At this time, you will be asked to login. Enter your username and password specified in your password file.

Step #4: Congratulations! You Just Hosted Your Website on Your Own Server

If you are NOT behind a firewall, you should now be able to access your web server from other computers by typing your IP address into a browser address bar. In case you were not what your IP is, you can visit What Is My IP to find out.

If you are behind a firewall (wireless router): You will have to open port 80 on the firewall and forward it to your computer.

Congratulations! Enjoy your home web server now!

Total Views: (28)

LEAVE A REPLY