1. Start Nginx
[email protected]:sudo ./sbin/nginx
2. Stop Nginx
[email protected]:sudo ./sbin/nginx -s stop[email protected]:sudo ./sbin/nginx -s quit
-s
Is the way to send a signal to Nginx.
3. Nginx Reload Configuration
[email protected]:sudo ./sbin/nginx -s reload
This is the way to send a signal to Nginx, or use:
[email protected]:service nginx reload
4. Specify the configuration file
[email protected]:sudo ./sbin/nginx -c /usr/local/nginx/conf/nginx.conf
-c
Indicates configuration
that the configuration file is specified.
5. View Nginx Version
There are two parameters that can be used to view Nginx version information. The first of these is as follows:
[email protected]:/usr/local/nginx$ ./sbin/nginx -vnginx: nginx version: nginx/1.0.0
Another type of display is the detailed version information:
[email protected]:/usr/local/nginx$ ./sbin/nginx -Vnginx: nginx version: nginx/1.0.0nginx: built by gcc 4.3.3 (Ubuntu 4.3.3-5ubuntu4) nginx: TLS SNI support enablednginx: configure arguments: --with-http_ssl_module --with-openssl=/home/luming/openssl-1.0.0d/
6. Check that the configuration file is correct
[email protected]:/usr/local/nginx$./sbin/nginx-tnginx: [alert] could 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 ok2012/01/09 16:45:09 [Emerg] 23898#0:open () "/usr/local/nginx/logs/nginx.pid" failed (13:permission denied) n Ginx:configuration file/usr/local/nginx/conf/nginx.conf test Failed
sudo (super user do
):
[email protected]:/usr/local/nginx$ sudo ./sbin/nginx -tnginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is oknginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
If shown above, the configuration file is correct. Otherwise, there will be hints.
7. Display Help information
[email protected]:/user/local/nginx$ ./sbin/nginx -h
Or:
[email protected]:/user/local/nginx$ ./sbin/nginx -?
These cover all the basic operations of Nginx routine maintenance, as well as the related commands that send signals to the master process, which we will see later.
Research on the configuration and deployment of high performance Web server Nginx (4) Nginx common commands