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

Method of Nginx configuration file

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

Share

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

This article mainly introduces "the method of Nginx configuration file". In the daily operation, I believe that many people have doubts about the method of Nginx configuration file. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "method of Nginx configuration file". Next, please follow the editor to study!

Configuration syntax for Nginx

The configuration file consists of instructions and instruction blocks

Each instruction ends with a semicolon, and instructions and parameters are separated by a space symbol

Instruction blocks organize multiple instructions together in {} curly braces

The include statement allows you to combine multiple profiles to improve maintainability

Use the # sign to add comments to improve readability

Use the $symbol to use variables

The parameters of some instructions support regular expressions

The time unit of the configuration parameter

Configure the spatial units of the parameter

Nginx Command Line

1.nginx send signal

# send reload signal to reload configuration file (same as kill-9) [root@i-vvwtw5ne sbin] #. / nginx-s reload # send stop signal to stop service immediately [root@i-vvwtw5ne sbin]. / nginx-s stop # send quit signal graceful stop service [root@i-vvwtw5ne sbin] #. / nginx-s quit # send reopen signal to restart logging file [root@i -vvwtw5ne sbin] #. / nginx-s reopen

two。 Get help from nginx

[root@i-vvwtw5ne sbin] #. / nginx-hnginx version: nginx/1.16.1Usage: nginx [-? hvVtTq] [- s signal] [- c filename] [- p prefix] [- g directives] Options: -?,-h: this help-v: show version and exit-V: show version and configure options then exit-t: test configuration and exit-T: test configuration Dump it and exit-Q: suppress non-error messages during configuration testing-s signal: send signal to a master process: stop, quit, reopen, reload-p prefix: set prefix path (default: / opt/nginx/)-c filename: set configuration file (default: conf/nginx.conf)-g directives: set global directives out of configuration file

3. Nginx uses the configuration file of $installPath/conf/nginx.conf by default, or you can use the specified configuration file, as follows

[root@i-vvwtw5ne sbin] #. / nginx-c / opt/nginx/conf/mynginx.conf

4. Test the configuration file for syntax errors

[root@i-vvwtw5ne sbin] #. / nginx-t

5. Print version information of nignx

[root@i-vvwtw5ne sbin] #. / nginx-v at this point, the study on "the method of Nginx configuration file" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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

Internet Technology

Wechat

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

12
Report