Top 15 Nginx Commands Every Linux Admin Should Know

Popular Nginx commands

Top 15 Nginx Commands

Start Nginx:

sudo systemctl start nginx 
[This command starts the Nginx web server]

Stop Nginx:

sudo systemctl stop nginx 
[This command stops the Nginx web server]

Restart Nginx:

sudo systemctl restart nginx 

[This command restarts the Nginx web server]

Kill Nginx Service:

sudo killall nginx
[This command when Nginx is not restart or not working]

Reload Nginx configuration:

sudo systemctl reload nginx 

[This command reloads the Nginx configuration without restarting the server]

Check Nginx configuration syntax:

sudo nginx -t 
[This command checks the syntax of the Nginx configuration files has any errors]

Show status of Nginx service:

sudo systemctl status nginx 
[This command displays the status of the Nginx service is running or not]

Enable Nginx to start on system boot:

sudo systemctl enable nginx 
[startup scripts]

Disable Nginx from starting on system boot:

sudo systemctl disable nginx 
[removes the startup scripts]

View Nginx access logs:

sudo tail -f /var/log/nginx/access.log 
[displays the Nginx acess log]

View Nginx error logs:

sudo tail -f /var/log/nginx/error.log 
[This command displays the Nginx error log ]

Test Nginx configuration and exit:

sudo nginx -t 
[check Nginx Configurations syntax errors and prints the result]

Show Nginx version:

sudo nginx -v 
[displays the version of Nginx installed on the system]

Show Nginx compilation options:

sudo nginx -V 
[displays the compilation options used when building Nginx]

Check Nginx worker processes:

sudo systemctl status nginx 
[This command shows the number of Nginx worker processes currently running]

Test Nginx server response:

curl -I localhost 
[This command sends a HEAD request to the local Nginx server and displays the server response headers.]

Note: these commands run in Linux-based operating system, such as Ubuntu or CentOS, and require administrative privileges (sudo) to execute.

Other Popular Articles:-

Leave a Reply

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

web_horizontal
About Us ♢ Disclaimer ♢ Privacy Policy ♢ Terms & Conditions ♢ Contact Us

Copyright © 2023 ResearchThinker.com. All rights reserved.