1 Answer

0 votes
by

Verify the Installation

We can verify the installation of Nginx in different ways:

1. Check the Version of Nginx

We can verify that the Nginx is installed and check its version by using the following command:

  1. $ nginx -v  

Output:

nginx version: nginx/1.17.0

2. Check Nginx is running or not

We can verify that the Nginx is installed and running by using the following command:

  1. $ ps -ef | grep nginx  

Output:

root   3105  1  0  15:39 ?       00:00:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;

www-data  3106  3105 0 15:39 ?   00:00:00 nginx: worker process
nikita 3186 1643 0 15:43 pts/0      00:00:00 grep --color=auto nginx


Verify the Installation

Here, the ps command is used to list the running processes. By piping it to grep, we can search for specific words in the output. This above example uses grep to search for nginx. The result shows three running processes, i.e., a master and two worker processes. If Nginx is running, we will always see a master and one or more worker processes. Hence, we can say that our installed Nginx is running properly.

3. Check your web server

If Nginx is installed successfully then the webserver should already be up and running:

We can check this by using the following command to make sure that the service is running:

  1. $ systemctl status nginx  

Output:

Verify the Installation

We can see from the above, the service appears to have started successfully. However, the best way to check this is to request a page from Nginx.

We can access the default Nginx page to make sure that the software is running properly. We can access this through our server's domain name or IP address. Or we can use http://localhost on Windows.

We should see the "Welcome to Nginx" default page. If we see that page, then we can be sure that Nginx has been installed properly.

Verify the Installation

This page is normally included with Nginx to show us that the server is running properly.

...