Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

10 commonly used Nginx commands to share

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "10 commonly used Nginx command sharing". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "10 commonly used Nginx command sharing".

Install the Nginx service

Depending on your system, select the corresponding command to install:

$sudo yum install epel-release & & yum install nginx [On CentOS/RHEL] $sudo dnf install nginx [On Debian/Ubuntu] $sudo apt install nginx [On Fedora]

View Nginx version

Command:

$nginx-v nginx version: nginx/1.12.2

If you want to see more detailed configuration items at the same time, use-V

Nginx-V nginx version: nginx/1.12.2 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017 TLS SNI support enabled configure arguments:-- prefix=/usr/share/nginx-- sbin-path=/usr/sbin/nginx.

View Nginx configuration syntax

Before starting the Nginx service, you can check that its configuration syntax is correct. This is especially useful when you modify or add configurations. The command is as follows:

$sudo nginx-t nginx: the configuration file / etc/nginx/nginx.conf syntax is ok nginx: configuration file / etc/nginx/nginx.conf test is successful

If you use uppercase T here, the effect is to test, discard, and exit.

$sudo nginx-T

Start the Nginx service

If there is a configuration syntax error, the command may fail. The command is as follows:

$sudo systemctl start nginx # systemd OR $sudo service nginx start # sysvinit

Boot self-start

The previous command is only temporarily activated, and this one is powerful:

$sudo systemctl enable nginx # systemd or $sudo service nginx enable # sysv init

Restart the Nginx service

Restart means stop and start.

$sudo systemctl restart nginx # systemd or $sudo service nginx restart # sysv init

View Nginx service status

This one looks at the service status information at run time.

$sudo systemctl status nginx # systemd or $sudo service nginx status # sysvinit

Reload Nginx service

Reload is to reload the configuration file, see the command:

$sudo systemctl reload nginx # systemd or $sudo service nginx reload # sysvinit

Stop the Nginx service

No matter why you want to stop it, you can use it:

$sudo systemctl stop nginx # systemd OR $sudo service nginx stop # sysvinit

View command help

If there's anything else you don't understand, or if you want to know other orders, use this.

$systemctl-h nginx Thank you for reading, the above is the content of "10 commonly used Nginx commands sharing". After the study of this article, I believe you have a deeper understanding of the problem of sharing 10 commonly used Nginx commands, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report