Introduction:

Nginx is the most popular web servers like an Apache web server. Hosting some of the largest and highest-traffic sites on the internet. It is the resource-friendly than Apache in most cases and can be used as a web server. We used Nginx with PHP itโ€™s called LEMP stack.

Step1: How to install Nginx

First, we have to update the apt packaging system in our system so that we have access to the most recent available packages. After that, we can install Nginx.

Update packages using command line:

$ sudo apt-get update

Install nginx command:

$ sudo apt-get install nginx

Step2: Check the available list of server in our system or server.

Nginx registers itself as a service with ufw. This makes it rather easy to allow Nginx access.

We can list the applications configurations that ufw knows how to work with below command:

$ sudo ufw app list

Above screenshot, you can see the list of available Nginx services

  1. Nginx Full: This profile opens both port 80 (localhost, unencrypted web traffic) and port 443 (TLS/SSL)
  2. Nginx HTTP: This profile opens only port 80 (localhost, unencrypted web traffic)
  3. Nginx HTTPS: This profile opens only port 443 (TLS/SSL encrypted traffic)

Now, you can enable the service that you want using below command:

$ sudo ufw allow 'Nginx HTTP'

$ sudo ufw status

Step3: Check your web server.

You can get to the default Nginx point of arrival to affirm that the product is running appropriately by going by your server’s space name or open IP address in your web server.

In the event that you don’t have an extra space name, or have no requirement for one, you can utilize your server’s open IP address. On the off chance that you don’t have the different idea about your server’s IP address, you can get it a couple of various courses from the order line.

ip addr demonstrate eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//" 

You will get back maybe a couple lines. You can attempt each in your web program to check whether they work.

An option is writing this, which should give you your open IP address as observed from another area on the web:

If you want to check the server is configure or not using curl command:

$ curl http://domain_name_or_ip_address

Otherwise, you can check directly on the browser using below:

htttp://domain_name_or_ip_address_or_localhost

Now, you can see below screen.

Step 4: Handle the Nginx services.

Now you can run or stop your server using below command.

Start your web server.

$ sudo service nginx start

Stop your web server.

$ sudo service nginx stop

Restart your web server.

$ sudo service nginx restart

We can check the web server restart automatically when the server will be rebooted.

$ sudo update-rc.d nginx defaults

So, Server was already configured correctly and that no action was necessary. Now Nginx service configures to boot time.

Conclusion:

Since you have your web server introduced, you have numerous choices for the kind of substance to serve and the advancements you need to use to make a richer experience.

Have something to share on the same? Tweet us on Twitter @letsnurture or drop a post on the official Facebook page of LetsNurture. Share your thoughts with us, we will be happy to have a discussion on the same.

Best of luck.

Want to work with us? We're hiring!
  • Rajendra

    Nice Read…. ๐Ÿ™‚

  • Ajarudin Gunga

    Useful and interesting stuff ..