How to install nginx

How to install nginx

What is Nginx?

Nginx is a web server similar to Apache HTTP server and Lighttpd. NGINX relies on an asynchronous event-driven architecture, which helps in creating multiple connections. It has become a very popular web server among DevOps due to its light resource utilization and its ability to scale easily.

How to install Nginx?

  1. Steps to install NGINX on Ubuntu:-
    1. Update server package list by
      sudo apt-get update
    2. Install NGINX by
      sudo apt-get install nginx
    3. Start Nginx server by
      sudo /etc/init.d/nginx start
    4. Check the status of the web server :
      sudo /etc/init.d/nginx status
    5. Now open browser and type <your server’s IP>:80 or on local system type localhost:80 or you can simply use curl command to check it is running or not.
      Type

      curl localhost:80

      and it should give output like :
      [email protected]:/home/vagrant# curl localhost:80
      <!DOCTYPE html>
      <html>
      <head>
      <title>Welcome to nginx!</title>
      <style>
      body {
      width: 35em;
      margin: 0 auto;
      font-family: Tahoma, Verdana, Arial, sans-serif;
      }
      </style>
      </head>
      <body>
      <h1>Welcome to nginx!</h1>
      <p>If you see this page, the nginx web server is successfully installed and
      working. Further configuration is required.</p><p>For online documentation and support please refer to
      <a href=”http://nginx.org/”>nginx.org</a>.<br/>
      Commercial support is available at
      <a href=”http://nginx.com/”>nginx.com</a>.</p><p><em>Thank you for using nginx.</em></p>
      </body>
      </html>

  2. Steps to install NGINX on Centos:-
    1. Update your server by
      sudo yum update
    2. Install NGINX by
      sudo yum install nginx
    3. Start the NGINX server by
      sudo /etc/init.d/nginx start
    4. Check the status of  the web server :
      sudo /etc/init.d/nginx status
    5. Now open browser and type <your server’s IP>:80 or on local system type localhost:80 or you can simply use curl command to check it is running or not.
      Type

      curl localhost:80

      and it gives output like :
      [email protected]:/home/vagrant# curl localhost:80
      <!DOCTYPE html>
      <html>
      <head>
      <title>Welcome to nginx!</title>
      <style>
      body {
      width: 35em;
      margin: 0 auto;
      font-family: Tahoma, Verdana, Arial, sans-serif;
      }
      </style>
      </head>
      <body>
      <h1>Welcome to nginx!</h1>
      <p>If you see this page, the nginx web server is successfully installed and
      working. Further configuration is required.</p><p>For online documentation and support please refer to
      <a href=”http://nginx.org/”>nginx.org</a>.<br/>
      Commercial support is available at
      <a href=”http://nginx.com/”>nginx.com</a>.</p><p><em>Thank you for using nginx.</em></p>
      </body>
      </html>

 

Leave a Reply

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