Today we will try a demo on how we can manage and deploy a blog website on the remote machine. We will be launching the website in the AWS cloud. Let's go.
First of all, let's create an EC2 instance in the AWS cloud.
Our EC2 instance is successfully created and running. We are using the free tier service on our project.
Let's connect to this EC2 instance from our local machine CLI using the SSH command.
Since the secret key permission was too open, we changed its permission to 400 and we are connected successfully to the EC2 instance from our local machine.
Let's install the Nginx server in the EC2 instance.
sudo apt install nginx -y
Verify whether the Nginx is started(actively running) or not
sudo systemctl status nginx
Our Nginx is successfully installed and running in the EC2 instance. Let's verify it.
Run the public ipv4 or ipv4 DNS, we can get the following result.
Let's download the blog template named "mini finance" from https://www.tooplate.com/. We can download any template of our wish and it's completely free to use.
Once downloaded, we need to copy this zip file to our remote instance.
We need to logout from the ec2 instance and from the local server we need to perform the following command.
scp -i ~/Downloads/abc.pem /home/subash/Downloads/2135_mini_finance.zip ubuntu@3.110.43.58:/home/ubuntu
The zip file is copied to the home directory as following:
Now we will unzip as follows:
Since there is no zip application in the new ec2 instance, we will install it and perform the unzip action.
sudo apt install zip
unzip 2135_mini_finance
Now we need to delete the welcome nginx code of index.html which is in /usr/share/nginx/html .
Now Let's move the content to the /usr/share/nginx/html folder.
mv 2135_mini_finance/* /usr/share/nginx/html
Even after updating the files if you are unable to see the demo website and still see the welcome page of nginx then you still need to do the following task.
Go to the /var/www/html folder and delete the html file. After that you need to move your website files to this folder and check back in your browser you will see the updated website.
After this, we can check the site address to view the update.
We can see the final result as above where our site is being deployed successfully.
In this way, we can deploy our website on our remote server from our local machine.
Happy Learning!!