Create An Basic HTML WEB Page On Apache2 Server in EC-2 Instance Using Ubuntu OS
Create your own HTML Web Server In Just 10 Steps.
First of All you have to Login to AWS Console with root or admin policy user. And from Console Search EC2 Service.
- To create an EC-2 instance Click on Launch instance tab . Then type Name of your Server (ex-HTML_WebPage).
- Select Amezon Machine Image (AMI) to Ubuntu or Anything You Want. In this program I will select ubuntu. Select Instance Type You Want And give Key Pair. If you don’t have key pair simply Create new one save on your computer.
- Create Security Group & Allow HTTPS & HTTP Traffic From the internet with Default one . And If you want to increase storage configure it .
- And jump hit on Launch Instance. Then Go to instance And Select the Instance which we created now and Connect via EC2 Instance Connect click on Connect. Now You have Successfully Connected EC2 instance with Basic Configuration.
- Then You have New Tab open as a Terminal[CLI] In Browser login with username by default. So you have to Switch To Root for that type
sudo -s
and hit Enter. Now You are root so you have to Update ang upgrade your instance by using
command. And update it.apt-get update && apt-get upgrade
- When your machine is upgraded you have to install a apache2 server. Apache is a popular open-source, cross-platform web server that is, by the numbers, the most popular web server in existence. For Installing apache2 just type
and hit enter and then it prompt you to install yes or no. Just you have to typeapt-get install apache2
Y
and enter. - Now your apache2 is install but not started. We have to start apache2 by typing the command
service apache2 start
- Now we have Default server so you have edit the HTTP servers index file. The file is stored in /var/www/html/ so you have go to that directory by using
cd
command. And then check the index file is there or not by usingls -a
command. For welcome landing page we edit the index.html file by nano command i.e
nano index.html
and then edit your welcome landing page(ex - Hello, Welcome to My New Web Server! 😊) .
And save it.Hey Congratulations We Have Created a Welcome Web Server using apache2. For checking your landing page type public-ip of instance (server) you created and paste on google and see the magic we created.
Note- You can Replace this index file with your code file and upload on server.