通过nginx安装目录的configure和makefile找到nginx的安装位置
通过nginx安装目录的configure和makefile找到nginx的安装位置
[root@VM-0-6-centos nginx-1.21.3]# cd objs/
[root@VM-0-6-centos objs]# ll
total 6028
-rw-r--r-- 1 root root 17954 Oct 31 20:02 autoconf.err
-rw-r--r-- 1 root root 41025 Oct 31 20:02 Makefile
-rwxr-xr-x 1 root root 5982984 Oct 31 20:05 nginx
-rw-r--r-- 1 root root 5527 Oct 31 20:05 nginx.8
-rw-r--r-- 1 root root 7270 Oct 31 20:02 ngx_auto_config.h
-rw-r--r-- 1 root root 657 Oct 31 20:02 ngx_auto_headers.h
-rw-r--r-- 1 root root 6043 Oct 31 20:02 ngx_modules.c
-rw-r--r-- 1 root root 87736 Oct 31 20:05 ngx_modules.o
drwxr-xr-x 9 root root 4096 Oct 31 20:00 src
打开上图的Makefile文件,可以看到下图:
nginx相关命令
上面那样,找到nginx的exe后,可以如下执行,查看支持的参数:
[root@VM-0-6-centos nginx]# ./nginx -h
nginx version: nginx/1.21.3
Usage: nginx [-?hvVtTq] [-s signal] [-p prefix]
[-e filename] [-c filename] [-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: /usr/local/nginx/)
-e filename : set error log file (default: logs/error.log)
-c filename : set configuration file (default: /usr/local/nginx/nginx.conf)
-g directives : set global directives out of configuration file
里面的nginx -V就可以查看到当初configure安装时候的参数:
[root@VM-0-6-centos nginx]# ./nginx -V
nginx version: nginx/1.21.3
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module
检查配置文件语法:
[root@VM-0-6-centos nginx]# ./nginx -t
nginx: the configuration file /usr/local/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/nginx.conf test is successful
检查配置文件语法并打印:
[root@VM-0-6-centos nginx]# ./nginx -T
nginx: the configuration file /usr/local/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/nginx.conf test is successful
# configuration file /usr/local/nginx/nginx.conf:
#user nobody;
worker_processes 1;
子进程的数量:
#user nobody;
worker_processes 1;
[root@VM-0-6-centos nginx]# ps -ef|grep nginx
root 610 1 0 12:15 ? 00:00:00 nginx: master process ./nginx
nobody 611 610 0 12:15 ? 00:00:00 nginx: worker process