Deploying Web Servers In Ubuntu/AWS Linux. (Nginx,Apache/httpd)

Deploying Web Servers In Ubuntu/AWS Linux. (Nginx,Apache/httpd)

What is Server?

  • Server is a system which provides data,service, programs or resources to another system.

  • There are different types of servers like web server,mail server,proxy server,database server and so on..

  • Here we will discuss about web server, that how one should install the web server in there respective system.

What is Nginx Server?

  • It is an open-source, fast, lightweight and high-performance web server that can be used to serve static files.

  • Nginx provides Reverse proxy, Load Balancing and caching also.

Deploying Nginx in AWS Linux/Ubuntu

  • Firstly, for this we need EC2 instance for deploying this.

  • You can check my EC2 blog in which I told how to configure EC2 instance in AWS.

  • After creating and connecting an instance you need to update the instance first

#ubuntu
apt update -y

#awslinux
yum update -y
  • after this we will install nginx in our server

      #ubuntu
      sudo apt install nginx -y
    
      #awslinux
      sudo yum install nginx -y
    
  • Now, our nginx server is installed and now we can access for our web browser.

  • to browse nginx we need to edit the security group of our instance and allow port number 80 to access the nginx server

  • then to active and enable the nginx server we use below command

      #for both ubuntu and aws linux
    
      systemctl start nginx 
      systemctl enable nginx
    
  • after allowing and enable nginx and port number now we are able to access the nginx server for web browser.

How to configure nginx html file

  • Nginx html file is present in var/www/html

  • Inside this path we have to create one index.html file for our web home page, we can add CSS or HTML code in this file

To add code we have to create index.html file like below command

vim index.html

Installing Apache Server

  • Apache is a free open source web server that delivers the content to internet.

  • It is use to display websites.

  • To install same process is needed like nginx that EC2,creating,connecting and update.

      #ubuntu
      sudo apt install apache2 -y
    
      #aws linux
      sudo yum install httpd -y
    
  • after installing we should start and enable apache/https with same command like nginx

  • both nginx and httpd have same port number i.e 80.

Home page of Nginx

Home page of httpd/apache2

With these steps you can configure nginx and apache in your ubuntu and aws linux server.