How to Host Your Own Website
Do you wish to host your site without the restrictions imposed by commercial web host providers? With our sure steps, hosting a website all by yourself has never been easier. You can do this from your home PC and let the website go public on the internet.
Just ensure you have a setup program to get a network. The network grants public access to the internet records of your site. This way, people can easily see your web pages through the internet.
We shall discuss how to host your own website in this article.
Local Hosting Using Windows
It is an exciting thing to host a website on your computer server. This option is only recommended if you want your site to be hosted on your localized development server. WAMP server is the essential tool for hosting a website on Windows.
WAMP Server: What Is It?
WAMP Server is the technical name for Windows, Apache, MySQL, and PHP. The WAMP server comes with three distinct applications. Servers like the WAMP are used because they enable an effortless downloading process and installation of all the programs.
These are the programs that you shall need for hosting in website. It is a more hassle-free method of downloading all the programs rather than downloading them from the internet separately. The following are the features of WAMP server:
- Windows: Windows operating system is used to indicate whether the AMP program will work on a Windows-operated device. For other platforms like Linux, you have LAMP instead.
- Apache: The Apache system is the central program that is used to execute the hosting functions. The Apache is a standalone program that allows the efficient hosting of HTML files and every other static site document.
- MySQL: MySQL is the suite that provides the database for all the features on your site. Dynamic pages of the website used for data storage use a database suitable for such an action. MySQL is dynamically employed for this purpose. It is used to store the passwords and usernames for personal accounts on the site.
- PHP: PHP is a commonly used package for generating dynamic website content. Joomla, Facebook, WordPress, and several other websites and web content management programs use PHP. It is such a useful program if you look to host dynamic web pages.
Those are the critical features of the WAMP server. These fundamental programs will enable the smooth operation of your website from your Windows PC. The WAMP server can be used to host your site in the following simple steps:
Steps in Hosting Your Website from Your PC
First Step: Install WAMP Server
To get started with the WAMP server, go to the official site to download it. Make sure you’ve downloaded the most recent version.
Depending on the rating of the operating system of your PC, select either the 64 or the 32 bits. The downloaded application is complete with all the installments you need, such as the Apache, MySQL, and my PHP.
Activate the included .exe file, which comes with the downloaded WAMP set up. You will get straightforward installation prompts.
Click on the “next” button while retaining the default settings and keep on installing the program. Select your chosen browser, or you could select “open” and have your Web Server get activated with your preferred PC browser.
During this process, it is essential to note that the windows system firewall could reject a few features which come with Apache. In this case, make sure that you’ve selected the right option as the security alert shows up.
Soon after you are done with the installation, you can mark out the box that is labeled as “Start WampServer 2 now.” After doing this, you need to select “Finish” to complete the process.
Second Step: Navigating the WAMP Server
This step shows you how to use some essential functions of the WAMP Server. If you have a particular preference for the web-server pages, click on the WAMP image, which is located in your notification panel.
It will direct you to the www directory. This directory gets generated automatically during installation. To find this, you can go to the address on the local disk C at (c: \\wamp\\www).
There is also the alternative to generate more subdirectories that are labeled as projects. The subdirectories are located in the system Wamp Server.
You shall effectively use this in the storage of PHP or the HTML files. For instance, if you proceed to install the WordPress program on your PC, the records for installation will be stored inside the directories. Various changes in this application can be updated by using the button for a refresh.
Third Step: Create an HTML or PHP Page
For this section, you can quickly test out your WebServer. You can use your Notepad program to create a basic PHP or HTML page. Click on the “Save as” button and name it while adding the system extension .php.
For instance, it could be mywebpage.php. Use the location, c:\\wamp\\www as the storage location for the file that you saved. Move back to the WebServer and use your refresh button to update the changes.
You would find your updated data located inside the www directory. You can test this by visiting http://localhost/name.php by using the web browser. It will take you to the new website page that you shall find all the information regarding the PHP installation.
Fourth Step: Configuring MySQL
This step outlines some of the critical steps used in the configuration of the MySQL system databases. To do this, you’ll need to go to the menu and open up the phpMyAdmin.
From this location, you can get a new window browser open. Doing this will automatically set the admin username to “root."
Then, you are told to create a password. At the moment, you could leave out the field area for the password. The MySQL databases can also be customized according to your preferences.
Fifth Step: Making the website to be public
The fifth step helps you to launch the site that you just created publicly. With what you have done so far, only you can see the website. The WebServer program makes it possible for you to access this through your system.
It is useful if you need this Web-server to develop your website and run the generated web application. At this point, you want your site to be accessible to the internet users once they type your domain name in the search engine.
To make your website go public, make sure you’ve selected the icon for the WampServer, and select the option labeled as “Put Online.”
However, it is essential to mention here that the file for Apache settings is set up to restrict external connection access, not the localhost. The message, “403 Forbidden” will be shown if someone clicks on the URL.
To solve this issue, you need to change up some coding instructions located in the file used to configure the Apache settings.
Go to the Apache folder, find the menu for the WampServer, and then find a file denoted as “httpd.conf.” You will need to scroll down until you find a code which is depicted as follows:
- Order Deny, Allow
- Deny from all
Delete this and then write the following:
- Order Allow, Deny
- Allow from all
That is all you’ll need to do. However, there are also more things to be done. Use a dedicated button, which you will find on the menu to restart all the Web-server services.
It allows internet users to access your site easily. It would be best if you tried to change several settings of the PC firewall to avoid hindrance to web requests. Furthermore, you can move the port 80 to the PC using your router.
Hosting Your Website from Your Linux
You can equally host your website from your Linux machine. However, to do this, you still need to install similar programs.
These are the Apache, the MySQL, and the PHP. Instead of having to install these programs individually, the LAMP Web-Server offers a package that has the three essential packages for hosting a website.
To effectively host your website on your page like your Windows Operating system, there are several essential steps that you need to follow.
What is LAMP software?
The LAMP software is a platform for open-source development of websites. It is an acronym for Linux, Apache, MySQL, and PHP.
In this case, the operating system for the open-source platform is Linux, while its web server is Apache. MySQL is the system for database management, while PHP is the scripting language for the application and content management.
Steps in Hosting Your Website from Your PC
First Step: Installing the LAMP Software
To get started, use any existing version for Linux to install the AMP package. The WebServer can be installed in your PC in two existing options. You could make use of the Ubuntu, which uses only a command line.
Alternatively, you can decide to select the normal Ubuntu desktop. For you to achieve this, you can input these simple command lines inside the terminal of the system:
sudo apt install apache2 MySQL-server php libapache2-mod-php7.0
Because the package has huge volumes of computer files to be downloaded, you could spend quite some time installing it.
Then subsequently, you need to try setting your root user password of MySQL. It is recommended that you confirm your password now.
If this field is left blank, changing the password once you set up the LAMP application will not become possible. The password is important.
You will need it every time you want your database updated or if you are looking to include other users into your system.
Furthermore, it is equally important that you change up the system Apache configuration anytime you need to start the Apache all over. This restarting operation is executed by using the command:
sudo /etc/init.d/apache2 restart.
But this is not usually the case if you execute this process while using files from the local .htacess application.
Second Step: Testing the PHP program.
There is a testing system provided by LAMP that can be used to check if PHP is functional. It can also be used to check the modules available.
To do this, add the PHP test file into the root directory of the WebServer, /var/www/html/. To try this, you can develop the test PHP website page will you will name as “name”. Next, input this code below inside the root directory web-server:
sudo echo "" > /var/www/html/name.php
Then, open up your web browser, then type in: http://localhost/name.php and press enter. On loading, it will display the test PHP application.
You should see the operating PHP version, the configuration, and the existing modules also. Subsequent PHP modules can be added later with the Ubuntu application manager, just if you see an application that needs it.
This manager for the graphical application has existing modules. The command line can also be used to access this by inputting the code: apt search php | grep module. It is as simple as it gets.
Third Step: Test MySQL
At this point, check for the successful installation of MySQL. This stage is necessary because, without the MySQL application, CMS programs like WordPress will never function.
To get your MySQL kit tested, input this command: service MySQL status. Once you click enter, it should begin the testing process. If it does not start, you can get your MySQL server started with this code: “Sudo service MySQL restarts.”
Furthermore, confirm the MySQL’s bind-address is from your system. It can be done simply by typing the command: cat /etc/hosts | grep localhost. You should have several results running on your PC screen along with the IP address.
Go to MySQL file for configuration and look for your PC’s bind address. You should see figures which resemble those you had seen earlier. If the figures are not the same, change it up to conclude this test.
The command-line system client for MySQL can be used to manage your databases. During the setting up of the MySQL, you created some admin credentials. They are used to gain entry into your server.
Now, you can use MySQL to develop a database. To improve a database, you could need a tool for database management like PhpMyAdmin.
Fourth Step: Installing PhpMyAdmin
To install the PhpMyAdmin program type in this command: “sudo apt-get install phpMyAdmin.” If it fails to install, you should repeat this process after reconfiguring all other repositories.
For example, if a specific blue screen appears asking you for the server that you want to be configured, use your space bar button to enter a command. If you see an asterisk, use the enter key to send a command.
You would see a prompt on your screen asking whether you want the PhpMyAdmin to generate your default database to be used exclusively, click on yes.
This way, to develop the database, you will have to input your password and admin username. To finish up this process, you will need to get the Apache restarted.
Fifth Step: Configuring the DNS
To get an individual domain name like mywebsite.com, you should get your PC web server configured. For you to do this, you can reset the system’s Apache settings so that internet requests can be granted. To successfully configure your DNS, follow the following steps:
Check the domain name to ensure it comes with an A record. It should be associated with a particular address.
The hosting service provider for the DNS automatically updates your DNS records. At this point, you can now check for the status of your configuration.
The dig application tool is used to do this. If successful, it will show back details that contain your web IP address, the domain name of the web, and the web’s authority section.
Sixth Step: Configuring Apache
If you download and install the most recent LAMP server, the Apache application will be ready to begin hosting websites using Linux on your PC.
The following steps help in the simple installation of the hosting configuration. These are exclusive for the named type of virtual hosts that are used to run sites in your directory.
To get started, you need to deactivate the Apache then default of the virtual host by inputting sudo a2dissite *default. Navigate to the directory for default storage known as /var/www/html with the command: : “cd /var/www/html”.
Create a new folder for hosting your website. Now you can change the name of the domain from mywebsite.com to the chosen name. To do this, input this command: sudo mkdir chosenname.com.
Go to your recently launched folder and create four new other sub-folders/directories inside this folder. The folders will help keep your files, backups, and files. Input the command:
sudo mkdir -p desiredname.com/public_html
sudo mkdir -p desiredname.com/log
sudo mkdir -p desiredname.com/backups
Next, open a new virtual hosting file with the following command:
sudo nano /etc/apache2/sites-available/desiredname.com.conf
At this point, the domain name will be changed from “chosenname.com” to “desiredname.com.conf.”
Now, you should create your web configuration for the virtual host. You can use the code command to execute this process.
Directory_Index index.html index.php (the files gets saved in this folder)
Custom_Log /var/www/html/desiredname.com/log/access.log combined
These changes can be saved by pressing the X and the control buttons together, then press the Y button, and you can press the “Enter” button to include your changes in the configuration file of the virtual host.
In the last stage, get your website activated by using this command: sudo a2ensite desiredname.com.conf. There will be a prompt telling you to restart your Apache to confirm your new system settings.
So far, all the steps will activate the Apache to activate your website. This entire process can be repeated for all other websites that you want to be hosted on a Linux PC with a LAMP server.
Benefits of Local Website Hosting
From the various options described above, it is understandable and straightforward that you can host your site remotely from your PC. This solution is useful for numerous sites we currently have around. Some people use this hosting method for their website due to the following benefits.
1). Great flexibility and control
Hosting your website remotely from your PC means that you can manage every part of the sites through the WebServer located on the PC. However, with commercial web-hosting providers, there are lots of restrictions that come with it.
These allow you to make use of the only provided web hosting function. You have no control to change certain aspects of your website technically. For instance, to replace your system’s domain name means that you need to go through the web hosting providers.
You do not have the control to improve your site. The flexibility of the method allows you to sublet some webspace to smaller companies; this makes you look like a mini-virtual server.
2). Cut down cost
When you host your own website from your PC, you cut down on the operational expenses per month or so. You can work readily with cheap equipment for this process.
This low-cost makes this in-house web hosting alternative an efficient solution. It is quite different from the virtual hosting option that leads to increased cost as your web operations grow.
3). Improve skills
When you set up your hosting service from your PC, you can improve your IT skills. With an improved ability such as this, you can promptly effect changes on IP address, domain name, configuration file, e.t.c. So, go ahead and learn how to host your own website practically.
Downsides to Self-Hosting Your Site
1). No access to extra services
Providers of commercial web hosting services have a larger digital footprint, which provides more bandwidth and space. Furthermore, they have such features as load balancing, security audits, and many more. You can barely get these services if you are self-hosting your website.
2). Poor security
Inadequate security is one of the downsides of hosting your website from your PC. The moment that the web-server becomes set up on your PC, other online users can see what is on your computer. This way, you become exposed to system hackers and malware, which can become risky to your data.
3). Reduced scalability
If not for the web-server application that you installed in your PC, it will not be capable of hosting your website. It means that your personal computer is intended to be used for web hosting functions.
It means that there is little room for scalability. You can not get more storage space, bandwidth, cooling systems, or power with your PC as your hosting web system.
4). Limited skills
Commercial web hosting services providers have staff that has the proper qualifications. However, it is just you alone who has to set up the web-server. You, therefore, have limited skills to sustain the process effectively.
The availability of your website depends on whether or not your PC is functional or not. If you host your websites from your PC, know that if your PC goes down, your website will be affected.
If your PC goes down, your site goes down too. It is also the case if there is a power outage. However, with commercial web hosts, your website is always operational.
6). High costs
You may have to dig deeper into your pockets to host a website using your machine. Be ready to purchase equipment like backup systems, UPS, software system patch handling programs, web maintenance services, and all that. Any web hosting provider can make these services possible in any one of their deals.
Other Alternatives to Self-Hosting
After learning how to host your own website, you can go ahead and do so. However, if the risks that come with self-hosting outweigh the benefits, don’t worry.
You can choose either a dedicated, shared, or virtual hosting plan. They are practically common and feasible alternatives.
The two conventional alternatives to website self-hosting are the
1). Virtual hosting
Here, you are using one server to host a website or several sites. Hosting a website via Virtual Private Server (VPS) is a common trend as they are affordable. The providers offer free web backup, reliable technical support, some email accounts, and a simple interface.
They are also easily scale-able. You could get shopping carts for your e-commerce platforms plus your customer loyalty schemes if you cough up additional fees.
However, hosting a web-site via a virtual hosting plan does not give you control to change certain things. You’ll need the consent of the hosting provider to effect changes in the web-server, such as the configuration file.
2). Dedicated hosting
Unlike a shared hosting plan, a dedicated hosting gives you one server to host a website. It can enable extensive network system connectivity for your server, or you could get the menu with several services such as monitoring and backup.
While such services may be unavailable for locally hosted websites, the dedicated hosting alternative can be quite costly. You get to pay for your bandwidth, space, and the data center’s power per month, year, e.t.c.
If you pay an extra amount of money, you may be given firewall management, technical support, bandwidth statistics information, and engineering time. The main benefit of this hosting alternative is it provides more unlimited speed and processing power than shared hosting. Compared to the virtual or shared hosting option, they have a little downtime.