HOW TO DO SELF-HOSTING OF YOUR WEBSITE_

Hey guys,

Here are a series of steps to be followed to launch your website using your pc as server.

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.

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.

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.”

Order Deny,Allow Deny from all

Replace the two lines above with the ones below:

Order Allow,Deny Allow from all

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:

100.100.100.100 example.com

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:

# Virtual hosts Include conf/extra/httpd-vhosts.conf

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.

ServerAdmin mail@example.com DocumentRoot “c:\wamp\www” ServerName mysite.local ErrorLog “logs/example.com.log” CustomLog “logs/example.com-access.log” common

Click “Restart All Services” in the WampServer menu to activate these changes.

Now your site should also be accessible via its domain name.

Advertisements

2 Comments

  1. Or get someone else to host it. For the non-tech-savvy types like myself you don’t actually need to literally self-host and download all this complicated WAMP stuff. Many companies will do this for you. You just ask them to set it up once you’ve signed. But beware of the affiliate links as bloggers get paid on people signing up from their host links. https://drunktree.com/2018/07/08/setting-up-a-self-hosted-wordpress-org-website-when-youre-far-from-tech-savvy-wamp-php-wtf/

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s