运行NGINX

1、nginx命令行参数

  • -c 为 Nginx 指定一个配置文件,来代替缺省的。
  • -t 不运行,而仅仅测试配置文件。nginx 将检查配置文件的语法的正确性,并尝试打开配置文件中所引用到的文件。
[root@VM-8-16-centos sbin]# ./nginx -t
nginx: the configuration file /opt/wang/openresty/nginx/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /opt/wang/openresty/nginx/nginx/conf/nginx.conf test is successful
  • -v 显示 nginx 的版本。
  • -V 显示 nginx 的版本,编译器版本和配置参数。
[root@VM-8-16-centos sbin]# ./nginx -v
nginx version: nginx/1.18.0
[root@VM-8-16-centos sbin]# ./nginx -V
nginx version: nginx/1.18.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/opt/wang/openresty/nginx/nginx/ --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35

2、nginx控制信号

TERM, INT 快速关闭
QUIT 从容关闭
HUP 重载配置用新的配置开始新的工作进程从容关闭旧的工作进程
USR1 重新打开日志文件
USR2 平滑升级可执行程序。
WINCH 从容关闭工作进程

[root@VM-8-16-centos sbin]# ps -ef|grep nginx
nobody   14862 14928  0 22:20 ?        00:00:00 nginx: worker process
root     14928     1  0 02:04 ?        00:00:00 nginx: master process ./nginx
root     14971 11810  0 22:20 pts/0    00:00:00 grep --color=auto nginx
[root@VM-8-16-centos sbin]# kill -HUP 14928
[root@VM-8-16-centos sbin]# ps -ef|grep nginx
root     14928     1  0 02:04 ?        00:00:00 nginx: master process ./nginx
nobody   15012 14928  0 22:21 ?        00:00:00 nginx: worker process
root     15018 11810  0 22:21 pts/0    00:00:00 grep --color=auto nginx
[root@VM-8-16-centos sbin]# kill -QUIT 14928
[root@VM-8-16-centos sbin]# ps -ef|grep nginx
root     15096 11810  0 22:21 pts/0    00:00:00 grep --color=auto nginx

3、nginx 启动、停止、重启命令

#启动
sudo /usr/local/nginx/nginx
#停止
kill -QUIT  nginx主进程号
kill -TERM nginx主进程号 
kill -9 nginx主进程号
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值