Easiest Way To Host Your Own Website From Home


How to Host Your Own Website from Home, Let’s imagine a world where hosting a website yourself is as simple and reliable as browsing the web. You could host your company’s site, your personal portfolio, your email server, and even messaging apps, while perusing Amazon’s feed or reading the latest Hacker News highlights, all from the comfort of your couch. The web would certainly be a more democratic place, from both an information-serving and information-browsing perspective.
Though the original vision for the World Wide Web included pieces of this idealism (e.g., directly showing filesystem content using hyperlinks), the reality turned out somewhat differently. Unfortunately, hosting your own website still has some serious obstacles, including dynamic IP addresses, bandwidth constraints, and electricity costs.
In this article, we look at how to host your own website on Microsoft Windows and on Linux, and also some of the drawbacks to doing this. For both platforms, we will install and use the AMP (Apache, Mysql, PHP) web stack. This AMP stack is commonly called WAMP on Windows and LAMP on Linux for obvious reasons.

Windows: How to Host a Website Using Your PC as a WAMP Server

First, let’s try hosting a website using your personal computer with the Windows operating system.

Step 1: Install the WAMP Software

To make this super easy, we’ll use a WAMP installation program (of which there are several) called WampServer. You could also opt to install each package manually, but this process requires much more work and is error-prone.
The WampServer package is delivered with the latest releases of Apache, MySQL, and PHP.
WampServer is one of several environments available to create Apache, MySQL, and PHP applications on Windows.
First, download the 32-bit or 64-bit WAMP-binary here, and begin the installation. Just follow the on-screen instructions, and when it’s done, launch WampServer.
Note: There may be a port 80 conflict with your Skype software, but there’s a fix for that.

Step 2: Using WampServer

Upon installation, a www directory will be created automatically. You’ll likely find it here: c:\wamp\www
From that directory, you can create subdirectories (called “projects” in WampServer), and put any HTML or PHP files inside those subdirectories.
The main screen of your localhost in WampServer should look something like this.
If you click on the localhost link in the WampSever menu or open your internet browser with the URL http://localhost, you should be shown the main screen of WampServer.

Step 3: Creating an HTML Page

To test our WampServer, we can put an example file called “info.php” into our www-directory.
Go directly to this directory by clicking “www directory” in the WampServer menu.
From there, create a new file with the contents below, and save it.
Now you can browse to http://localhost/info.php to see the details of your PHP installation. You can create any HTML and PHP file structure to suit your needs.

Step 4: Configure MySQL

If you click on the phpMyAdmin menu option, you can start configuring your MySQL databases (which may be needed for a CMS like WordPress).
The phpMyAdmin login screen will open in a new browser window. By default, the admin username will be root, and you can leave the password field blank.
From there, you can create new MySQL databases and alter existing ones. Most software, like WordPress, will automatically set up a new database for you, though.

Step 5: Make the Site Public

By default, the Apache configuration file is set to deny any incoming HTTP connections, except in the case of someone coming from the localhost.
To make your site publicly accessible, you need to change the Apache configuration file (httpd.conf). You can find and edit this file by going to the WampServer menu, clicking “Apache,” and selecting “httpd.conf.”
Replace the two lines above with the ones below:
Restart all WampServer services by clicking “Restart all Services” in the menu.
The site should now be accessible from beyond your localhost. Confirm there isn’t a PC firewall blocking web requests. You may need to set up port-forwarding on your internet router as well.

Step 6: Using a Domain Name

To use a domain name, such as example.com, with your WAMP installation, we’ll need to configure some files first. Let’s assume our example.com domain has an A record in your DNS with the IP address 100.100.100.100.
First, we need to add the following line to the C:\Windows\system32\drivers\etc\hosts file:
Now, we need to edit httpd.conf again (accessible via the WampServer menu) to add a virtual host. Once that file is open, look for “Virtual hosts,” and uncomment the line after it, like this:
Now we need to add a file manually in “C:\wamp\bin\apache\Apache-VERSION\conf\extra\” (VERSION is your Apache version).
Then create a file in Notepad with the following content, and save it in that Apache directory.
Click “Restart All Services” in the WampServer menu to activate these changes.
Now your site should also be accessible via its domain name.

Linux: How to Host A Website on a Linux Machine

Let’s now cover how to set up Apache, MySQL, and PHP on a Linux system.

Step 1: Install Software

To start our LAMP software install, type the following in the terminal:
During the installation process, you will be asked to enter (and re-enter) a password for the MySQL root user.
Have your MySQL root password handy during the LAMP installation process.
Technically, it’s not necessary (as it should have been done upon installation), but just to be sure, we will restart the Apache web server.
Any time you change the global configuration of Apache, you need to execute the command below, unless you do the configuration using local .htaccess files.

Step 2: Check PHP

To confirm your PHP server works and see what PHP modules are currently available, you can place a test PHP file in the web server root directory (/var/www/html/):
We can now visit that PHP page by browsing to http://localhost/info.php.
You should see the currently running PHP version, current configuration, and currently installed modules. Note that you can later install other PHP modules using the Ubuntu package manager, as some PHP applications might require that.
To determine which extra modules are available, search within the graphical package manager, or simply use the command line:

Step 3: Check MySQL

As most CMS systems (e.g., WordPress) use MySQL, we will also look at that part.
To see if your MySQL installation is working, type “service mysql status.”
We see that MySQL is up and running. If you don’t see this, you can type “sudo service mysql restart” to restart the MySQL server.
From here, we can use the MySQL command line client to manage databases.
For this, we need to use the admin credentials we typed earlier when MySQL was installed.
From here, we can do anything we want with MySQL, e.g., create a new database:
Often times, the CMS will automatically create the database for you, but sometimes you need to do something to the database manually (e.g., create a backup or optimize tables).
PHPMyAdmin is a friendly database management tool most web experts will recommend.
You can install PHPmyadmin by typing the following into the terminal:
Finally, configure the /etc/phpmyadmin/config.inc.php file using the steps described here.

Step 4: Configure DNS

To use your own domain (e.g., example.com) for your local web server, you’ll need to configure Apache to accept web requests for your domain.
First, make sure your domain’s DNS has an A record (which points to a specific IP address) for your domain name, e.g., www.example.com. Your DNS hosting provider will have online tools to correctly set up these DNS records.
Once that is done, you should be able to see something like this using the dig tool. To request the A record for www.example.com, type:
Here, a web link for http://www.example.com would be directed to the server with IP address 100.100.100.100.

Step 5: Configure Apache

Now we need to tell Apache to accept web requests for our name www.example.com and from what directory to serve content when we get those requests.
First, we set up a directory for our example.com domain, then we create an example index.html file, and finally, we set some filesystem permissions:
To see this page, the last step is to set up a Virtual Host file for Apache for our domain.
Now edit the file to look like this (the optional comments are not shown here):
Now reconfigure and reload Apache for the changes to take effect:
Edit your local /etc/hosts file by adding a line with your IP address and domain name. Be sure to change the “100.100.100.100” to match the IP address of your domain:
We should now be able to visit our self-hosted site by going to http://www.example.com.

Step 5: Install Your CMS System of Choice

You can install a CMS platform of your choice — popular options being WordPress, Joomla, and Drupal — either manually or by using the package management of Ubuntu.

Why We Say Hosting a Website Yourself is a Bad Idea (1 Pro, 4 Cons)

So we’ve covered that it’s doable — but just because you can do something doesn’t mean you should. Let’s look at the pros and cons.

The Up Side (1)

The upshot: Setting up your own website and its hosting is not just a highly educationalexperience but it’s rather fun to execute. It’s a geeky project, sure, but if you’re reading this, you probably fall into the category of folks who would call that fun. So there.
Once you’ve done it, you will have the power to make any system changes you desire. A lot of folks have gone from learning to host a site locally to learning more about programming, web design, and online commerce. The experience is the biggest draw.

The Downsides (4)

Unfortunately, there are still quite significant downsides to self-hosting your website:
  1. You’ll experience slow connections compared to professional hosts. Your ISP upload speed is likely much slower than your download speed, so serving content to your website visitors will be very slow, too.
  2. You have to deal with an ever-changing (dynamic) IP address. Though there are DNS configuration tools to help with this somewhat, this can potentially cause problems at any time.
  3. It costs a lot of electricity and you’ll run into power outages often.
  4. You’re responsible for hardware and software maintenance.
So you can see why we highly encourage investing in a quality web host for your site or application. And we have you covered there, too.

Share Your Views With NewsSplashy
 This Post First Appeared On Newssplashy- Latest Nigerian News Today

Post a Comment

Previous Post Next Post