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

How to start nginx under linux

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

Share

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

How to start nginx under linux? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!

Detailed explanation of nginx startup command of linux

Start the operation

Nginx-c / usr/local/nginx/conf/nginx.conf

The-c parameter specifies the path of the nginx configuration file to load

Attached: nginx stop command under linux

Stop the operation

The stop operation is done by sending a signal to the nginx process

Step 1: query the nginx main process number

Ps-ef | grep nginx

Look for the master process in the process list, and its number is the main process number.

Step 2: send a signal

Stop Nginx calmly:

Kill-QUIT main process number

For example: kill-QUIT 16391

Quickly stop Nginx:

Kill-TERM main process number

Force stop Nginx:

Kill-9 main process number

In addition, if the pid file storage path is configured in nginx.conf, the file is stored in the Nginx main process number, if not specified, it is placed in the logs directory of nginx. With the pid document, instead of querying the main process number of Nginx, we send a signal directly to Nginx with the following command:

Kill-signal type'/ usr/local/nginx/logs/nginx.pid'

Smooth restart

If you change the configuration, you have to restart Nginx. Do you want to close Nginx and then turn it on? No, you can send a signal to Nginx and restart smoothly.

Smooth restart command:

Kill-HUP resides in the title or process number file path or uses / usr/nginx/sbin/nginx-s reload

Note that after modifying the configuration file, it is best to check whether the modified configuration file is correct, so as to avoid errors in Nginx that affect the stable operation of the server after restart. The command to determine whether the Nginx configuration is correct is as follows:

Nginx-t-c / usr/nginx/conf/nginx.conf or / usr/nginx/sbin/nginx-t Thank you for reading! After reading the above, do you have a general understanding of how to start nginx under linux? I hope the content of the article will be helpful to all of you. If you want to know more about the relevant articles, you are welcome to follow the industry information channel.

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