How to Host Your Own Website from Home

host your own website

 

Host your own website?
 
What is this 1996? 
 
No. There are plenty of good reasons to host your own website from home, and we break down how to do it right here.
 

Looking at the options for hosting a website may have you wondering whether it might be worth the time to set up hosting on your own end. Building a server and then installing the appropriate software is a simpler process than you might expect. You’re already paying for an internet connection, so it may even be more cost-effective to not add another bill to the pile. Let’s take a look at how to accomplish that, and then we’ll also review some of the potential pros and cons of learning how to host a website from home.

Getting Ready

It’s wise to have all the resources you need in place prior to trying to build your server and roll out your website. Most folks who decide to host their own sites from home elect to use some variant of the Apache-MySQL-PHP stack. If you’re comfortable utilizing Linux, the LAMP stack is an excellent choice. If you’d prefer to utilize Windows, there are a couple options worth considering there, too. For individuals who have minimal experience dealing with server administration, the WAMP stack is typically more appealing.

You should check that your current internet connection allows you to host a web server. It’s not uncommon for home- or business-grade internet routers and modems to block the common ports used for HTTP transmission, such as port 80. A quick only port scan of your system will help you determine whether the port is available. If not, you will have to check the manual for your modem and router to see how to open it up to the outside world. In some cases, ports may also need to be opened at the operating system level. This is rare in Linux, but it happens with some Windows installations.

You’ll need to obtain an installer for your server stack. If you already have a version of Windows up and running, you can visit WampServer.com to obtain an EXE file that’ll allow you to install the server through an intuitive interface that’ll be familiar to anyone who has installed Windows software before. Should you wish to have something a little more portable, XAMPP is an excellent choice that uses MariaDB, a community-supported variant of MySQL. Those who have Ubuntu running and are comfortable using the command-line interface can simply execute a series of instructions to install a standard LAMP server.

Knowing the Components

From time to time, it will be necessary to be familiar with the software that underpins your installation. This includes:

Apache is the web server that underlies the entire installation. It acts as the traffic cop, directing requests from website visitors to appropriate resources and then seeing that the resources are sent to the requester. Apache is very good at hosting both static HTML documents and dynamic code, and this has made it one of the most popular platforms on the web. It’s also highly modifiable, but for the sake of simplicity, we try to refrain from doing more modifications than are necessary to talk to the outside world.

MySQL is a database system that’s commonly used for an array of purposes. If you’re simply looking to host static web pages, you won’t need to worry yourself about MySQL. Should you wish to store information that’s entered by visitors, MySQL is critical. It also frequently serves the role of storing information about pages if you’re using a blogging platform like WordPress.

PHP is a scripting language that’s normally used to serve dynamic web pages. For example, a script named “account.php” might be used by all users on your website to see account information once they log in. The data would be stored in MySQL, and it would be displayed by the PHP script upon retrieval. This can significantly reduce the number of static pages you’ll be required to code.

Installing WampServer

When you visit the website, make a point of identifying whether you need the 32- or 64-bit version. You can determine what version you need by clicking the Start button and entering the word “Computer” into the search box. When you see “Computer” listed in the available choices, right-click on it and then click “Properties.” An entry for “System type” will be included in a list of information about your operating system. This entry will explain whether you’re running a 32- or 64-bit OS.

Once you’ve downloaded the .exe file, you can run it. Simply keep clicking on the “Next” button to accept the default values. If a security alert comes up asking about the firewall, make an exception for Apache. When the installation is complete, simply check the box next to “Start WampServer 2 now” and click the “Finish” button.

Navigating the Server

Once the installation process is finished, you’ll likely want to make sure everything is where it needs to be. A WAMP icon should appear in the notification pane, and you can click on it. You may also navigate to it by visiting “c:wampwww” or whatever directory you might’ve entered during the installation process. The top level of this directory hosts the files that all requests will be directed to. For example, a request for “yoursite.com” will lead Apache to fetch the “index.htm” or “index.php” file, with preference being giving to the htm file if both exist. If you open a text editor and make changes to the index files, you can see what happens when you refresh the page in the browser.

Configure MySQL

Any outwardly facing database should be configured as soon as possible. WampServer offers a phpMyAdmin panel in its menu. You should also be able to access phyMyAdmin by visiting “yoursite.com/phpMyAdmin” and seeing what appears. This is usually case-sensitive, so you may need to include the capitalized letters.

You should now be prompted to enter a password. If you are just experimenting with a locally hosted setup, you can leave this empty for the sake of expediency. If anyone in the outside world has access to the server, please up a strong password before going further. You’ll also want to keep track of the password you set since a variety of software packages that use MySQL to store entries will ask for it.

Becoming Publicly Available

When you’re ready to make your server available to the whole world, you can click on the WampServer icon and select the “Put Online” option. In general, this is only recommended if you’re prepared to have a site facing outward. If you’re just using it for learning purposes, you should be careful about this. If you’d prefer to edit the files yourself, you can locate the httpd.conf file that handles this function by navigating to “c:wampbinapacheApache2.2.11conf” and clicking on it. In the file, you’ll see a “Deny from all” entry, and you want to change the word Deny to Allow.

You’ll also need to set up the hosts file in Windows. This can be found at “C:Windowssystem32driversetchosts” and needs to be edited to include an entry typing the A record for your DNS to the domain. An entry might look something like “75.75.100.100 yoursite.com” and nothing else.

There’s a dedicated button in the WampServer menu that’ll allow you to reset all services. This will ensure the changes take effect. If you have problems connecting from an outside system, you may need to recheck whether your firewall settings are correct. It’s also important to see that port 80 is being routed to your PC through your modem and router combination. You should try using a computer off your network to test the availability of your website, as Windows frequently detects requests originating at and answered by the same machine as a type of loopback attack.

Installing a LAMP Server

One of the advantages of using Linux versus Windows is the ability to handle the majority of the operations in the command-line interface. As an added bonus, the package manager system tends to do a very good job of identifying specific compatibility issues and remedying them on its own, so you don’t spend as much time worrying about whether you got the appropriate 32- or 64-bit version. Most production environments also employ some type of LAMP server, so you’ll also be working in a setting that’s closer to a typical professional environment. This can make learning how to host a website from home into a bit of resume builder.

For the sake of simplicity, we’ll assume you’re using a desktop version of Ubuntu. You can begin the install process by opening a virtue terminal and entering the command “sudo apt install apache2 mysql-server php libapache2-mod-php7.0” and waiting for the package manager to process some things. You may be prompted for your admin passwords, and you’ll likely be asked to confirm installation of several different items. You’ll also be prompted once the installation is completed to enter a root password for your MySQL installation. When everything is done, you can enter the command “apache2 restart” just to make sure everything has fired up as expected.

Installing phpMyAdmin

You’ll likely want an interface where you can work with MySQL entries more directly, so it’s wise to add phpMyAdmin to your toolbox before moving forward. The command “sudo apt-get install phpmyadmin” should get you everything you need. You’ll be asked some questions about the server you want to use it with, but the default is typically Apache2, so you should be able to hit enter since it will already be highlighted. You will be prompted at some point to enter the MySQL username and password you entered during the initial LAMP install. Once all is good, you can load your browser and go to “http://localhost/phpmyadmin/” to see that everything is working.

Facing the World

You’ll need to configure Apache virtual hosts in order to tie your domain name to your server. The default setting needs to be turned off using the command “sudo a2dissite *default” and it will need to be directed to the domain. In the command-line interface, you’ll need to navigate to “cd /var/www/html” and add three entries. These are performed using the commands:

  • sudo mkdir -p yoursite.com/public_html
  • sudo mkdir -p yoursite.com/log
  • sudo mkdir -p yoursite.com/backups

Each of these will create a unique entry that’ll hold the public files, logs and backups for the domain.

You’ll also need to create a new host file for the site using the command “sudo nano /etc/apache2/sites-available/ yoursite.com.conf” and adding some entries to the newly created file.

<virtualhost>

ServerAdmin youremail@ yoursite.com

Server_Name yoursite.com

Server_Alias www. yoursite.com

Directory_Index index.html index.php

Document_Root /var/www/html/yoursite.com/public_html

LogLevel warn

Custom_Log /var/www/html/yoursite.com/log/access.log combined

</virtualhost>

Hit control-X to save the entries, they hit Y and enter to commit them. With the command “sudo a2ensite yoursite.com.conf” you can then enable the domain name to answer on your serve. It’s also not a bad idea to run “apache2 restart” just to be on the safe side.

Pros and Cons of Self-Hosting

The most obvious pro of hosting your own server is going to cost. Taking a server bill of the board can have immense advantages. You’ll also be able to configure your server to your liking. Many hosts impose limitations on what you can install on a server, while you can add whatever you like. This may be especially beneficial if you’re looking to use a specialized piece of software on your side of the process to do something like compile or compute data that’ll be served.

Another big advantage is your ability to configure the server to your like. Hosting tends to come in packages, and that can limit how much computing power is put to work on a website. If you want to double the amount of RAM on your server, it’s as easy as popping in a couple sticks.

The biggest downside to self-hosting is that you’re on the hook for everything. You are the tech support provider. You’re also the security consultant. If updates need to be performed, that’s also on you.

Availability can also pose challenges when dealing with how to host your own website. For example, if your electric goes out, your website will go down. While backup battery solutions can be helpful, the reality is high-end ones that would give you days of availability are going to be expensive to the point they’d eradicate years of cost savings.

Speed also tends to be a limiting factor. With the exception of a view business-grade internet packages, your connection is likely to be more of a speed bottleneck on a self-hosted solution versus one from a hosting provider. You’ll also likely be using consumer-grade hardware, which can also slow server response down.

Security can be a major issue. It’s generally advised that you don’t self-host a highly transactional website unless you’re highly confident in your admin and coding skills. Even for a highly capable self-hoster, there’ll be a high level of dependency on automated monitoring tools. You also may incur major legal liability for control of credit card number and personal information.

Conclusion

Self-hosting can be a fun way to handle a relatively minor type of website. It’s also cost-effective in many cases. It’s just cool to tell people you know how to host your own website, too.

You should, however, be aware of the implications when hosting your own server. It’s also beneficial to have a full plan set out for your website before you start piecing together a solution. By picking a clear path, such as WAMP vs LAMP, you can ensure the deployment process will be as painless as possible.

Last Updated on October 21, 2020 by Joe

This Tool Might Be the Best Way to Find Your Next Web Host

There’s a lot of data, comparisons, and facts to keep in your little head when comparing web hosting companies. It’s quite overwhelming.

We combed through some of our favorite hosts, broke out their features, and created this quick 2-minute quiz to recommend the best host for your current needs:

Share This Post

The Ultimate Guide to Web Hosting & Website Builders

Download our homemade guide on setting up a new website and stay updated.

More To Explore

Webflow vs Wix

Webflow and Wix, two giants vying for dominance in the website creation space. One, a champion of professional designers and agencies with its advanced tools

AI Website Builders

AI Website Builders are all the rage. This is our starting list of all the AI website builders we can find, with our proprietary editorial

Shared Hosting Rankings

We apply our editorial opinion and updated web research to create our own proprietary shared hosting rankings. Methdolology Update Frequency Update Log: Last Updated on

be sharp

Get 50% off hosting before black friday

Sign up and we’ll shoot you over our favorite deals and discounts right away.