Last Updated : 23 Jul, 2025
Nginx is written in C language by Igor Sysoev to overcome the C10K problem (i.e. Concurrently handling 10k(ten thousand) connections). The problem was how to optimize the network socket to handle numerous clients at the same time. Nginx is a solution to that problem. It is a free and open-source software for reverse proxying, load balancer, web serving, media streaming, etc. It is pronounced as "Engine X", by eliminating the letter "e" from this, the name becomes "Nginx". In this article, we are going to see a step-by-step guide on how to install and configure the Nginx server from the source.
Features of Nginx:Step 1: Download the Nginx archive from this link and save the archive file on your desktop.
Nginx Download pageOr, you can download the Nginx web server archive file by running the following command in the terminal.
wget http://nginx.org/download/nginx-1.21.1.tar.gzDownloading the Nginx server
wget will fetch the archive file and save it to the location where you have opened the terminal.
Step 2: After downloading the archive, we need to navigate the folder where we have downloaded that archive and have to extract the archive using any archive utility. You can run the following command to extract the Nginx archive file.
tar -xf nginx-1.21.1.tar.gz
After this, the folder structure should look like this.
Nginx folderStep 3: Now, to begin the installation of Nginx, navigate to the extracted folder and open the terminal here, then run the following command.
cd ~/Desktop/nginx-1.21.1
./configure
Here below is a summary of the configuration file:
Configuration summary + using system PCRE library + OpenSSL library is not used + md5: using system crypto library + sha1: using system crypto library + using system zlib library nginx path prefix: "/usr/local/nginx" nginx binary file: "/usr/local/nginx/sbin/nginx" nginx configuration prefix: "/usr/local/nginx/conf" nginx configuration file: "/usr/local/nginx/conf/nginx.conf" nginx pid file: "/usr/local/nginx/logs/nginx.pid" nginx error log file: "/usr/local/nginx/logs/error.log" nginx http access log file: "/usr/local/nginx/logs/access.log" nginx http client request body temporary files: "client_body_temp" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp"
make
sudo make install
This command will install Nginx in the /usr/local/nginx directory.
Step 4: Confirm the installation and check the installed version of Nginx by running the following command:
Navigate to /usr/local/nginx using the cd command (change directory):
cd /usr/local/nginx/sbin
To check what is the current installed version of the Nginx.
./nginx -vSuccessfully installed Nginx Starting the Ngnix server
Follow the following steps to start an Nginx server.
cd /usr/local/nginx/sbin
2. Now, we can start the Nginx server by running the following command:
sudo ./nginx
To see if it's working, go to the local host or your URL.
Nginx start (Welcome page) Change the default Nginx listen portBy default, the Nginx is configured to listen on port 80. If you want to change the default Nginx listening port, you can do that by reconfiguring the nginx.conf file located under /usr/local/nginx/conf.
Steps to change the default Nginx Listen Port.
Step 1: Open the nginx.conf file by running the following command:
sudo nano /usr/local/nginx/conf
Step 2: After opening, the nginx.conf file should look like this:
configuring listen portNavigate to this server section and change listen 80; port to any other port number, e.g. 5555, etc.
Step 3: Save the file and run open the localhost with port 5555 as follows.
custom listen port Stopping the Nginx serverTo stop the Nginx server, we just need to add the flag -s to stop the Nginx command as follows.
sudo ./nginx -s stop
This will stop the Nginx server, you can refresh the localhost page and see.
Nginx stop Uninstalling the Nginx serverTo uninstall Nginx, run the following command in the terminal with superuser permissions, i.e. sudo :
sudo rm -f -R /usr/local/nginx && rm -f /usr/local/sbin/nginx
This will completely remove Nginx from your machine. Here, we are using rm command to remove the directories and subdirectories using -f and -R flags. -f is used to remove the directories, and -R will recursively remove all the directories within directories. Using &&, we can write multiple commands in a single line.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4