How to setup a web-hosting server

This article helps you to set up a web hosting server or web-server.  A web server is a server that keeps all our website content such as files, images, and videos in a folder in server hard drive. When a person hits our site name on their browser,  the browser start serves the content which presents in the webserver.  Before reading this article I recommend you to go through my other article that is “starting a website without writing code“.  This article helps you to understand how you can start a website.

As I mentioned earlier,  we will set up a web-hosting server. For this, we need a server with a public IP address. You can contact any server providing company for this ( a quick Google search helps you)  but here I am using  AWS cloud ( Amazon Web Service). We will set up our hosting environment on the AWS cloud. To start a server on AWS we need to sign up with AWS for this use below link. Aws is providing a free tier for one year.

https://portal.aws.amazon.com/billing/signup#/start

One you signed up with AWS login to the console with the credential. Go to the services and select EC2 under the Compute option.

 

To launch an instance or server click on the Launch Instance button.

 

In the next page, we have to choose what OS type we want, for example, CentOS or Ubuntu, here I am choosing Amazon Linux AMI as it belongs to AWS free tier click on Select button.

next, we have to choose server type or server configuration in free tier we can use a server with 1CPU and 1GB memory.  Select the type as t2.micro and click Configure Instance Details.

The next page keeps every detail are same as the default ( Don’t change any value if you don’t what you are doing). Then click on the Storage button to configure storage size.

Here I am adding 10G as the storage size for my server. In the free tier, you can use up to 30G.

The next page is for adding a tag, you can add any value here. If you have multiple customers you can give customer name as the tag value. Click on Configure Security Group, here we configure a firewall for our server. Select “Create a new security group” and give a name you like. Here I am giving “webserver-firewall” as my security group. In the Source tab, for security select  “My IP”, so you can only access the server.

Next, click on Review and launch and then click on launch. It asks us to create a new key to access our server. Given a name like webserver-key and download it.

Download the private key and keep it safe. Please note that once we lost this key then we can’t access the server.  Then click launch you can see a message that instance is launching. Click on the tab view instances to see the server that we created.

Here you can see AWS automatically allowed public IP address to our instance.

To easily identify our server we can give a name to this instance for this click on the pencil symbol in the name column. I have given the name as Webserver.

Yeah. We have created a server to host our website. To access our newly created server we need public IP and the key that we saved earlier.

Use an ssh client to access the server. Putty is the common ssh client used to access the Linux server from Windows.

Give public IP address in the Hostname field and click on SSH on the left side and then click browse to select the private key that we downloaded earlier. The username to log in is ec2-user.

Next, we have to install some software ( Packages) to host our website.

The following is the list of packages that we will install.

  1. Apache: Used to host a website
  2. MySQL: Database used by our website
  3. PHP: WordPress is built in PHP language
  4. WordPress: Website template to design the website

The following link helps you to install all these packages on our AWS Linux server.

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-lamp-amazon-linux-2.html

And for installing WordPress please follow

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html

 

2 comments

Leave a Reply

Your email address will not be published. Required fields are marked *