: This article mainly introduces common Nginx commands. For more information about PHP tutorials, see. 1. start Nginx/usr/local/nginx/sbin/nginx
Poechant @ ubuntu: sudo./sbin/nginx
2. stop Nginx
Poechant @ ubuntu: sudo./sbin/nginx-s stop
Poechant @ ubuntu: sudo./sbin/nginx-s quit
-S sends signals to Nginx.
3. Nginx reload configuration
Poechant @ ubuntu: sudo./sbin/nginx-s reload
The above method is to send a signal to Nginx, or use:
Poechant @ ubuntu: service nginx reload
4. specify the configuration file
Poechant @ ubuntu: sudo./sbin/nginx-c/usr/local/nginx/conf/nginx. conf
-C indicates configuration, which specifies the configuration file.
5. View Nginx version
There are two types of parameters for viewing Nginx version information. The first type is as follows:
Poechant @ ubuntu:/usr/local/nginx $./sbin/nginx-v
Nginx: nginx version: nginx/1.0.0
The detailed version information is displayed as follows:
Poechant @ ubuntu:/usr/local/nginx $./sbin/nginx-V
Nginx: nginx version: nginx/1.0.0
Nginx: built by gcc 4.3.3 (Ubuntu 4.3.3-5ubuntu4)
Nginx: tls sni support enabled
Nginx: configure arguments: -- with-http_ssl_module -- with-openssl =/home/luming/openssl-1.0.0d/
6. check whether the configuration file is correct
Poechant @ ubuntu:/usr/local/nginx $./sbin/nginx-t
Nginx: [alert] cocould not open error log file: open () "/usr/local/nginx/logs/error. log" failed (13: Permission denied)
Nginx: the configuration file/usr/local/nginx/conf/nginx. conf syntax is OK
16:45:09 [emerg] 23898 #0: open () "/usr/local/nginx/logs/nginx. pid" failed (13: Permission denied)
Nginx: configuration file/usr/local/nginx/conf/nginx. conf
TestFailed
If the above message is displayed, no access error is returned.
LogsFile and process, sudo (super user do:
Poerchant @ ubuntu:/usr/local/nginx $ sudo./sbin/nginx-t
Nginx: the configuration file/usr/local/nginx/conf/nginx. conf syntax is OK
Nginx: configuration file/usr/local/nginx/conf/nginx. conf test is successful
If the preceding information is displayed, the configuration file is correct. Otherwise, there will be related prompts.
7. display help information
Poechant @ ubuntu:/user/local/nginx $./sbin/nginx-h
Or:
Poechant @ ubuntu:/user/local/nginx $./sbin/nginx -?
[Root @ centos-1-22 sbin] #./nginx-t
Nginx: the configuration file/usr/local/nginx/conf/nginx. conf syntax is OK
Nginx: configuration file/usr/local/nginx/conf/nginx. conf test is successful
[Root @ centos-1-22 sbin] #./nginx-h
Nginx version: nginx/1.0.15
Usage: nginx [-? HvVtq] [-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
-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:/usr/local/nginx /)
-C filename: set configuration file (default: conf/nginx. conf)
-G directives: set global directives out of configuration file
The above covers all the basic operations of Nginx routine maintenance, as well as the commands for sending signals to the master process. we will see them later.
The above describes common Nginx commands, including some content, and hope to help those who are interested in PHP tutorials.