NGINX is one of a handful of servers written to address the C10K problem. Unlike traditional servers, NGINX doesn’t rely on threads to handle requests. Instead it uses a much more scalable event-driven (asynchronous) architecture. This architecture uses small, but more importantly, predictable amounts of memory under load. Even if you don’t expect to handle thousands of simultaneous requests, you can still benefit from NGINX’s high-performance and small memory footprint. NGINX scales in all directions: from the smallest VPS all the way up to large clusters of servers.
- What is Nginx
- Install Nginx on Ubuntu
- Check Nginx Version
- Test Nginx default Config
- Start Nginx Service
- Check Nginx Status
- Stop Nginx Service
- How to Restart Nginx Service
- How to Perform Nginx Test Reload
- Check Nginx Configuration
- Log Rotate Nginx Files
- Upgrade Nginx
- Show Nginx Help
- 9 Popular Nginx Commands You Should Know
- Quit Nginx
- Reload Nginx
- View server status
- Test Nginx configuration
- Show command help
- Summary
- Nginx Status Explained
- Nginx — Starting, stopping, and restarting
- Configuring the Nginx status page
- Reading the Nginx status page
What is Nginx
Nginx is an Open Source web server and uses a non-threaded, event driven architecture.

How to Update or Upgrade CentOS
Install Nginx on Ubuntu
To install Nginx on Ubuntu, you need to use sudo apt-get install nginx command. This command will check the availability of Nginx package in the repository and then download and install it.
Check Nginx Version
To check nginx version, you need to use sudo nginx -v command
Test Nginx default Config
To test Nginx default config, use sudo nginx -t or sudo service nginx configtest nginx commands. It is very important to test your configuration before starting or restarting nginx test config to avoid any unnecessary error.
Start Nginx Service
To start Nginx Service, you need to use sudo systemctl start nginx or sudo service nginx start command.
Check Nginx Status
To check nginx status after doing any changes, you need to use sudo systemctl status nginx or sudo service nginx status command.
Stop Nginx Service
To stop nginx service, you need to use sudo systemctl stop nginx or sudo service nginx stop command.
How to Restart Nginx Service
To restart nginx service, you need to use sudo systemctl restart nginx command or sudo service restart nginx.
How to Perform Nginx Test Reload
To reload nginx service, you need to use sudo systemctl reload nginx command or sudo service reload nginx command.
Check Nginx Configuration
You can check nginx configuration using sudo nginx -T command. This nginx commands will show all the current configuration in detail and exit out.
Log Rotate Nginx Files
If you want to log rotate Nginx files, you can use sudo service nginx rotate command.
Upgrade Nginx
To upgrade nginx service, you need to use sudo service nginx upgrade command.
Show Nginx Help
If you want to see all the supported options with nginx commands, you need to use sudo nginx -h command.
- Nginx Commands
- Restart Nginx
- Nginx Config
- What is Nginx
- Nginx Tutorial
- How to restart Nginx
- Nginx Config File
How to get complete dependencies List of RPM
9 Popular Nginx Commands You Should Know
Nginx is one of the most popular web servers in the world. So whether you’re currently using it or not, chances are if you’re a web developer, chances are you’ll likely come in contact with it at some point. Therefore there are a few important Nginx commands you should be aware of in order to get familiar with the basics of this web server.
In this guide, we’re going to go over what these popular Nginx commands are, how to use them, and what each one does.
If you’re using a systemd based version such as Ubuntu Linux 16.04 LTS and above, use systemctl within the command, like so:
service nginx stop
systemctl stop nginx
This command can still, however, take some time on busy servers. Therefore, if you want Nginx to stop even faster, you can also use:
killall -9 nginx
Quit Nginx
service nginx quit
systemctl quit nginx
service nginx restart
systemctl restart nginx
Reload Nginx
service nginx reload
systemctl reload nginx
View server status
service nginx status
systemctl status nginx
nginx is running
Test Nginx configuration
You can test your Nginx server’s configuration file before restarting or reloading it completely. This helps prevent any unforeseen errors which can cause your website to gown down. To do this there are two separate commands you can use, both return the same information:
service nginx configtest
systemctl config nginx
nginx: the configuration file /etc/nginx-sp/nginx.conf syntax is ok
nginx: configuration file /etc/nginx-sp/nginx.conf test is successful
service nginx -v
systemctl -v nginx
Show command help
service nginx -h
systemctl -h nginx
service nginx -?
systemctl -? nginx
Summary
The Nginx commands shown in this article are a few of the most popular ones. There do exist a few other parameters; however, these aren’t used nearly as much. Reference this guide whenever you’re stuck for an Nginx command, and hopefully, you’ll find the one you need.
Nginx Status Explained
This article explains the process used to check the current status of your Nginx server as well as how to use the ngx_http_stub_status_module to gain more insight about your web server. Having the information provided by the Nginx status page can be useful to help determine information pertaining to the number of requests your server is currently receiving, the amount of active connections, etc.
Nginx — Starting, stopping, and restarting
# sudo service nginx status
If your Nginx server is currently running, the above command will return * nginx is running and * nginx is not running otherwise.
Similar commands can also be used to start, stop, or restart the server.
sudo service nginx stop
sudo service nginx start
sudo service nginx restart
Configuring the Nginx status page
Nginx offers a convenient way to check the server status with the module ngx_http_stub_status_module. With this module, you’ll be able to view important information pertaining to your Nginx server on a status page.
Most modern versions of Nginx have this module already compiled, there is no need to compile it manually. You can check if the module is already compiled by using this command:
If -with-http_stub_status_module appears within the configure arguments, then everything is working correctly. If you do not see this module upon running the above command, you may use the -with-http_stub_status_module configuration parameter when building Nginx from source.
As a next step, the Nginx config needs to be prepared. Go to the folder where your Nginx config is located and open the file with an editor (e.g. VI).
Reading the Nginx status page
Once you have completed the above section, you now have access to view the Nginx status page. To view the status page you now have two options.
- In a browser, navigate to your website URL /nginx_status (e.g. https://www.example.com/nginx_status)
- Alternatively, you may use curl to retrieve the same information.curl https://example.com/nginx_status
The output of Nginx status will look similar to this:
Active connections: 43
server accepts handled requests
7368 7368 10993
Reading: 0 Writing: 5 Waiting: 38
- Three figures are shown:All accepted connections.All handled connections, which normally equals to the total number of accepted connections.Total number of handled requests.
- All accepted connections.
- All handled connections, which normally equals to the total number of accepted connections.
- Total number of handled requests.
- Reading: Nginx reads request headers
- Writing: Nginx reads request bodies, processes requests, or writes responses to a client
- Waiting: Keep-Alive connections. This number depends on the keepalive_timeout.
With this module, you can now better monitor your Nginx status to get a clearer picture of your server’s connection/request stats.

