python win32process
命令 |
解释 |
nginx -h |
帮助 |
nginx -? |
帮助 |
nginx -v |
看版本号 |
nginx -V |
看版本号+看包含的编译安装的组件 |
sudo nginx -t |
检测nginx.conf文件是否没有语法错误,看见最后2行ok、successful |
nginx -s quit |
优雅的停止 shut down gracefully 注释1 |
nginx -s reload |
重启 注释2 |
nginx -s reopen |
利用reopen信号可以使nignx进程重新打开日志文件, 以便实现日志分割的效果。 |
|
|
service nginx -h |
帮助 |
service nginx -? |
帮助 |
service nginx -v |
看版本号 |
service nginx -V |
看版本号+看包含的编译安装的组件 |
service nginx configtest |
检测nginx.conf文件是否没有语法错误,看见最后2行ok、successful |
service nginx status |
看运行情况 |
service nginx start |
开启 |
service nginx stop |
停止 shut down quickly |
service nginx restart |
重启 |
service nginx reload |
重启 注释2 |
|
|
systemctl -h nginx |
帮助 |
systemctl -? nginx |
帮助 |
systemctl -v nginx |
看版本号 |
systemctl -V nginx |
看版本号+看包含的编译安装的组件 |
systemctl config nginx |
检测nginx.conf文件是否没有语法错误,看见最后2行ok、successful |
systemctl status nginx |
看运行情况 |
systemctl start nginx |
开启 |
systemctl stop nginx |
停止 shut down quickly |
systemctl quit nginx |
优雅的停止 shut down gracefully 注释1 |
systemctl restart nginx |
重启 |
systemctl reload nginx |
重启 注释2 |
注释1:与stop信号的作用类似, quit信号作用也是用于停止nginx服务, quit信号和stop信号的区别在于, nignx进程收到stop信号以后会立即停止服务, 而收到quit信号后, 不会再接收新的请求, 但是会先处理完已经接受的链接请求, 处理完这些请求之后再停止服务,这种停止方式被称之为"优雅的停止"。
注释2:reload信号的作用就是在不停止服务的情况下重载配置文件, 比如, nginx正在正常的提供服务, 此时,管理员修改了nginx.conf文件中的配置指令, 管理员希望新的配置立刻生效, 但是又不希望重启nginx服务, 此时就可以使用nginx -s reload命令重载配置文件, 以便在不重启nginx的情况下载入新的配置, 同时避免了因重启而造成的服务中断。
service nginx status
看运行情况
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
重定向至 /bin/systemctl status nginx.service
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2022-08-16 16:44:32 CST; 16h ago # 最近启动时间、持续时长
Process: 85064 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Process: 85066 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 85068 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
Main PID: 85069 (nginx) # 主进程
Tasks: 17
Memory: 22.1M
CGroup: /system.slice/nginx.service
├─85069 nginx: master process /usr/sbin/nginx # 主进程
├─85070 nginx: worker process # 子进程
├─85071 nginx: worker process
├─85072 nginx: worker process
├─85073 nginx: worker process
├─85074 nginx: worker process
├─85075 nginx: worker process
├─85076 nginx: worker process
├─85077 nginx: worker process
├─85078 nginx: worker process
├─85079 nginx: worker process
├─85080 nginx: worker process
├─85081 nginx: worker process
├─85082 nginx: worker process
├─85083 nginx: worker process
├─85084 nginx: worker process
└─85085 nginx: worker process
# 下面最近4句操作
8月 16 16:44:31 用户名 systemd[1]: Starting The nginx HTTP and reverse proxy server...
8月 16 16:44:31 用户名 nginx[85066]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
8月 16 16:44:31 用户名 nginx[85066]: nginx: configuration file /etc/nginx/nginx.conf test is success>
8月 16 16:44:32 用户名 systemd[1]: Started The nginx HTTP and reverse proxy server.
nginx -v
版本信息
[root@server1 ~]# nginx -v
nginx version: nginx/1.16.1
nginx -V
可以看有什么组件
在编译安装时,设置一些编译选项,比如
安装目录、各种文件的目录、编译器选项等等
4个部分 - Nginx - 二进制可执行文件
4个部分 - Nginx.conf
4个部分 - access.log访问日志 - 记录每一条http请求
4个部分 - error.log 错误日志 - 定位问题
[root@server1 ~]# nginx -V
nginx version: nginx/1.16.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_realip_module --with-http_image_filter_module=dynamic --with-http_ssl_module