If you are planning to launch a web site however don’t desire to pay recurring month-to-month or annual internet hosting charges, you should utilize any outdated laptop computer or desktop PC to host a web site for free. It’s a good way to make the most of your outdated system as a substitute of throwing it away.
In this information, we’ll set up and arrange companies on our 10-year-old laptop computer to host a PhrasePress, Joomla, or customized HTML or PHP-based web site with a free SSL certificates.
Things You Will Need to Host a Website
Following are the pre-requisites to host a web site for free from dwelling with simply your laptop:
- An outdated laptop computer or PC working Ubuntu Server.
- A registered area title for your web site
- Ethernet cable to join the laptop computer or PC to router for dependable and quick connection
Step 1: Update and Upgrade the Packages
After putting in Ubuntu Server in your laptop, execute the next command to replace the package deal listing and improve present packages. We advocate you allow SSH and entry the server by way of Terminal or PuTTY in your macOS or Linux PC.
sudo apt replace && Sudo apt improve –y
This could take a whereas to end. So, sit again and loosen up till the method completes.
Step 2: Install Apache
Apache is a fashionable open-source net server that works with PHP to host dynamic web sites, together with PhrasePress websites. Once the replace is full, execute the next command to set up the Apache server.
sudo apt set up apache2
When you see a immediate, press Y after which hit the Enter key to proceed the set up. You can test the standing by working the next command.
systemctl standing apache2
It ought to present lively (working) standing. To confirm, you may go to the IP of your laptop computer or localhost.
Step 3: Install MySQL Server
MySQL is a database administration system (DBMS) that helps arrange and supply entry to the database for storing the data. To set up the MySQL Server, use the next command.
sudo apt set up MariaDB-server MariaDB-shopper
Press Y after which the Enter key to affirm and proceed with the set up.
Next, safe the MySQL set up by working the next command.
Set root password? Press Y and hit the Enter key. Enter a safe password and maintain it protected.
Remove nameless customers? Press Y after which the Enter key.
Disallow root login remotely? Press Y after which the Enter key.
Remove the check database and entry it. Press the Y key adopted by the Enter key press.
Reload privilege tables now? Press the Y key after which Enter.
Step 4: Install PHP
PHP is required to course of code for displaying dynamic content material, run scripts, join to the MySQL database and show the processed content material on the net browser. To set up PHP, run the next command.
sudo apt set up PHP PHP-MySQL
Press the Y key to affirm and proceed with the set up. Create a check.php file utilizing the next command to affirm the set up.
sudo nano /var/www/html/check.php
Now, paste the next code into the Nano editor.
Press CTRL+X adopted by Y and the Enter key to save the adjustments. Now, go to the IP of your laptop computer with /check.php within the URL. This ought to load the PHP info web page, indicating PHP is put in and dealing.
Step 5: Create a MySQL Database and User
We want to create a database and consumer account with entry to the database with all privileges. The instructions are as follows:
sudo MySQL –u root -p
Type the password (the one you created whereas securing the MySQL set up) and press the Enter key. Then execute the next instructions within the given order to create a database and consumer with full entry to the database.
CREATE DATABASE mysite;
CREATE USER ‘ravi’@’localhost’ IDENTIFIED BY ‘YourPassword’;
GRANT ALL ON mysite.* TO ‘ravi’@’localhost’ IDENTIFIED BY ‘YourPassword’;
This will create a database named “mysite” with consumer “ravi” having entry to the database. Of course, you should utilize any title you want.
You can now host a customized HTML, PHP-based web site, or host CMS-based websites, similar to PhrasePress, PrestaShop, Joomla, and many others. However, we’ll arrange and host a PhrasePress web site on our outdated laptop computer for this tutorial.
Step 6: Download and Setup PhrasePress
Navigate to the /var/www/html path and download the newest PhrasePress package deal.
sudo wget "https://wordpress.org/latest.tar.gz">https:
Extract the package deal contents.
Sudo tar xf newest.tar.gz
This will extract the wordpress listing at /var/www/html location. You can view the listing utilizing the ls command. Next, we’ll grant permission to www-data:www-data utilizing the next command.
sudo chown -R www-data:www-data /var/www/html/wordpress
Once achieved, you may go to the IP of your laptop computer adopted by /wordpress. Enter the Database Name, Username and Password we created in Step 4. Leave Database Host and Table Prefix to default. Click on Submit.
Now, click on on Run the set up.
Enter the Site Title. Also, create a new Username and Password for the PhrasePress backend (wp-admin), after which click on Install PhrasePress. This will set up PhrasePress, after which you’ll be able to entry the PhrasePress website at http://IP-Address/wordpress (Replace the IP-Address subject together with your laptop’s IP).
Next, we’d like to add the area title and allow SSL for the HTTPS connection. For this, we’re going to use the safe Cloudflared Tunnel.
Step 7: Download and Install Cloudflared Service
Sign up and add your area to your Cloudflare account to get began. After including the area, run the next instructions to download and set up the Cloudflared service in your outdated laptop computer or PC-based net server.
sudo wget https:
sudo dpkg –I cloudflared-linux-amd64.deb
Step 8: Create Cloudflared Tunnel and Enable HTTPS
Follow the directions and use the instructions beneath to create a Cloudflared tunnel and allow a safe connection to your web site.
Log in and authorize the area you added to Cloudflare.
Cloudflared tunnel login
Copy the URL displayed and open it in a net browser to authorize the area.
Once licensed efficiently, create a Cloudflared tunnel known as “mysite”. You could title it something however keep in mind that title.
Cloudflared tunnel create mysite
Copy the credentials file path (JSON file path) and the tunnel ID. Keep them protected.
Now, create a configuration file utilizing the command beneath.
Sudo nano ~/.cloudflared/config.yml
Next, paste the next code into it. Make certain to exchange the tunnel ID and credentials-file (JSON file path).
credentials-file: /dwelling/pi/.cloudflared/ a2efc6dg1-2c75-45f8-b529d3ee.json
- hostname: YourArea.com
- service: http_status:404
Press CTRL+X adopted by Y and hit Enter to save the adjustments.
Now create a DNS entry for the hostname. You can host your PhrasePress website on the primary area or subdomain based mostly in your requirement. For this tutorial, we’ll create a subdomain DNS entry to host our PhrasePress website on the outdated laptop computer.
cloudflared tunnel route DNS <Tunnel Name> <YourArea.com>
Here’s an instance:
cloudflared tunnel route DNS mysite mysite.smartghar.org
Once the entry is created efficiently, you can begin the tunnel by working the next command.
Cloudflared tunnel run mysite
You can open the net browser and go to the hostname (mysite.smartghar.org on this case). You ought to give you the chance to entry the PhrasePress website. However, you might even see CSS has damaged and HTTPS disabled.
To repair this, log in to https://yoursite.com/wp-admin, go to Settings > General Settings, and replace the PhrasePress Address (URL) and Site Address (URL) fields to YourAreaName.com or YourAreaName.com/wordpress as per your configuration.
Then, log in to Cloudflare, head over to SSL/TLS > Overview from the left pane, and select both “Flexible” or “Full” for the area you added.
Once achieved, go to the URL and entry your web site. Your website ought to now load absolutely with an HTTPS connection.
Is Free DIY Hosting Worth It?
If you are simply getting began with constructing a web based service, portal, or enterprise, a native DIY server on an outdated PC or laptop computer might help you. You can use it to showcase your tasks to shoppers or customers and host a absolutely practical web site.
Although the internet hosting is free and safe, keep in mind that you’ll have to pay for your laptop’s electrical energy utilization, which is able to differ based mostly on its effectivity. Typically, it is between 30-65W/hour at full load for laptops, however desktop PCs will devour rather more energy. A less expensive and extra power-efficient choice could be to use a Raspberry Pi to host your website, because it runs on a 15W energy provide.