pc网站建设怎么做,126企业邮箱注册,中国建设银行公积金网站,免费制作图文的软件目录 一、实验
1.环境
2.Kali Linux 使用nmap扫描CentOS
3.Kali Linux 远程CentOS
4.Kali Linux 使用openvas 扫描 CentOS
5.Nginx 热升级
6.Nginx 平滑回退
二、问题
1.kill命令的信号有哪些
2.平滑升级与回退的信号 一、实验
1.环境
#xff08;1#xff09;主机…目录 一、实验
1.环境
2.Kali Linux 使用nmap扫描CentOS
3.Kali Linux 远程CentOS
4.Kali Linux 使用openvas 扫描 CentOS
5.Nginx 热升级
6.Nginx 平滑回退
二、问题
1.kill命令的信号有哪些
2.平滑升级与回退的信号 一、实验
1.环境
1主机
表1 主机
系统版本IP备注CentOS7.9192.168.204.200nginx升级主机Kali Linux2024.1 192.168.204.146动态 192.168.204.100静态 已部署openvas 2查看Kali Linux (2024.1)系统版本
cat /etc/os-release3查看Kali Linux (2024.1)系统IP地址
ip addr 2.Kali Linux 使用nmap扫描CentOS
1扫描网段存活主机
nmap -sP 192.168.204.0/242扫描主机
nmap 192.168.204.200 3扫描主机系统
nmap -O 192.168.204.2004扫描22端口开放情况
nmap -sS -p 22 192.168.204.200 5hydra 破解密码
hydra -l root -P test.txt 192.168.204.200 ssh 3.Kali Linux 远程CentOS
1远程
ssh root192.168.204.200 2查看nginx版本
系统做了版本隐藏与修改
[rootwww ~]# nginx -v3查看进程
nginx未启动
[rootwww ~]# ps axuw | head -1;ps axuw | grep nginx
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 3061 0.0 0.0 112676 984 pts/1 R 12:32 0:00 grep --colorauto nginx
[rootwww ~]#
[rootwww ~]# ps -ef | grep -E CMD|nginx
UID PID PPID C STIME TTY TIME CMD
root 3063 3006 0 12:32 pts/1 00:00:00 grep --colorauto -E CMD|nginx测试 [rootwww ~]# curl -I 127.0.0.1
curl: (7) Failed connect to 127.0.0.1:80; 拒绝连接[rootwww ~]# curl -I 192.168.204.200
curl: (7) Failed connect to 192.168.204.200:80; 拒绝连接4查看nginx安装位置
[rootwww ~]# whereis nginx
nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/local/sbin/nginx /usr/local/nginx /usr/share/nginx /usr/share/man/man3/nginx.3pm.gz /usr/share/man/man8/nginx.8.gz5重启服务
[rootwww ~]# systemctl restart nginx测试
[rootwww ~]# curl -I 192.168.204.200
HTTP/1.1 200 OK
Server: IIS777
Date: Tue, 19 Mar 2024 04:34:59 GMT
Content-Type: text/html; charsetutf-8
Content-Length: 59
Last-Modified: Tue, 04 Jul 2023 13:39:01 GMT
Connection: keep-alive
ETag: 64a420f5-3b
Accept-Ranges: bytes[rootwww ~]# curl -I 192.168.204.200
HTTP/1.1 200 OK
Server: IIS777
Date: Tue, 19 Mar 2024 04:35:01 GMT
Content-Type: text/html; charsetutf-8
Content-Length: 59
Last-Modified: Tue, 04 Jul 2023 13:39:01 GMT
Connection: keep-alive
ETag: 64a420f5-3b
Accept-Ranges: bytes6查看进程
nginx已启动
[rootwww ~]# ps axuw | head -1;ps axuw | grep nginx
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 3142 0.0 0.0 20532 688 ? Ss 12:34 0:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 3143 0.2 0.1 24292 2724 ? S 12:34 0:00 nginx: worker process
nginx 3144 0.0 0.1 24292 2724 ? S 12:34 0:00 nginx: worker process
nginx 3145 0.0 0.1 24292 2724 ? S 12:34 0:00 nginx: worker process
nginx 3146 0.0 0.1 24292 2724 ? S 12:34 0:00 nginx: worker process
nginx 3147 0.0 0.1 24292 2724 ? S 12:34 0:00 nginx: worker process
nginx 3148 0.0 0.1 24292 2724 ? S 12:34 0:00 nginx: worker process
nginx 3149 0.0 0.1 24292 2724 ? S 12:34 0:00 nginx: worker process
nginx 3150 0.2 0.1 24292 2972 ? S 12:34 0:00 nginx: worker process
root 3158 0.0 0.0 112676 984 pts/1 S 12:35 0:00 grep --colorauto nginx
[rootwww ~]# ps -ef | grep -E CMD|nginx
UID PID PPID C STIME TTY TIME CMD
root 3142 1 0 12:34 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 3143 3142 0 12:34 ? 00:00:00 nginx: worker process
nginx 3144 3142 0 12:34 ? 00:00:00 nginx: worker process
nginx 3145 3142 0 12:34 ? 00:00:00 nginx: worker process
nginx 3146 3142 0 12:34 ? 00:00:00 nginx: worker process
nginx 3147 3142 0 12:34 ? 00:00:00 nginx: worker process
nginx 3148 3142 0 12:34 ? 00:00:00 nginx: worker process
nginx 3149 3142 0 12:34 ? 00:00:00 nginx: worker process
nginx 3150 3142 0 12:34 ? 00:00:00 nginx: worker process
root 3160 3006 0 12:35 pts/1 00:00:00 grep --colorauto -E CMD|nginx7继续查看版本
[rootwww ~]# nginx -v
nginx version: IIS777
[rootwww ~]#
[rootwww ~]# rpm -qa | grep nginx
nginx-filesystem-1.20.1-10.el7.noarch
nginx-1.20.1-10.el7.x86_64
[rootwww ~]# /usr/local/sbin/nginx -V
nginx version: IIS777
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
configure arguments: --prefix/usr/local/nginx --usernginx --groupnginx --with-http_stub_status_module8查看nginx文件
本机存在2个版本的安装包
[rootwww nginx]# find / -name nginx*9查看配置文件
确定本机安装版本为1.22.0
[rootwww nginx]# vim /usr/local/nginx/conf/nginx.conf [rootwww nginx]# vim /opt/nginx-1.22.0/src/core/nginx.h 4.Kali Linux 使用openvas 扫描 CentOS
1端口列表(Port Lists)
Configuration - Port Lists (2)创建端口
选择带星号图标 3弹出界面 4扫描80端口 5新增http 5)目标主机(Targets)
Configuration - Targets (6) 创建扫描目标
选择带星号图标 7弹出界面 8扫描目标 9扫描任务
Scans -Tasks (10) 创建扫描任务
选择带星号图标 11弹出界面 12设置 查看扫描方式 14查看点击底部播放按钮 15开始扫描
观察变化 16查看扫描结果
Scans -Reports
点击左下角时间查看信息 17下载报告
点击左上角下载图标 18弹出界面 查看下载类型 选择PDF 5.Nginx 热升级
1查看版本
最新版本为1.25.4
https://nginx.org/download/ 2下载
[rootwww opt]# wget no-check-certificate https://nginx.org/download/nginx-1.25.4.tar.gz3备份
[rootwww nginx-1.25.4]# cd ~
[rootwww ~]# cd /usr/local/nginx
[rootwww nginx]# ls
client_body_temp conf fastcgi_temp html logs passwd.db proxy_temp sbin scgi_temp uwsgi_temp
[rootwww nginx]# cd ..
[rootwww local]# ls
bin etc games include lib lib64 libexec mysql nginx php sbin share src stress
[rootwww local]# cp -pr ./nginx ./nginx_20240319_1.22.0
[rootwww local]# ls
bin etc games include lib lib64 libexec mysql nginx nginx_20240319_1.22.0 php sbin share src stress4解压
[rootwww opt]# tar xf nginx-1.25.4.tar.gz5编译
[rootwww local]# cd /opt/nginx-1.25.4/
[rootwww nginx-1.25.4]# ls#这里指定的安装路径前缀和老的nginx保持一致
[rootwww nginx-1.25.4]# ./configure --prefix/usr/local/nginx --usernginx --groupnginx --with-http_stub_status_module[rootwww nginx-1.25.4]# make(6)验证
[rootwww nginx-1.25.4]# ls
auto CHANGES CHANGES.ru conf configure contrib html LICENSE Makefile man objs README src
[rootwww nginx-1.25.4]# cd objs
[rootwww objs]# ls
autoconf.err Makefile nginx nginx.8 ngx_auto_config.h ngx_auto_headers.h ngx_modules.c ngx_modules.o src7备份旧的Nginx二进制
[rootwww objs]# cd /usr/local/sbin
[rootwww sbin]# ls
nginx php-fpm
[rootwww sbin]# mv ./nginx ./nginx_1.22.0
[rootwww sbin]# ls
nginx_1.22.0 php-fpm8拷贝新的Nginx二进制
[rootwww sbin]# cd ..
[rootwww local]# ls
bin etc games include lib lib64 libexec mysql nginx nginx_20240319_1.22.0 php sbin share src stress
[rootwww local]# cp -pr /opt/nginx-1.25.4/objs/nginx ./sbin查看
[rootwww local]# cd sbin
[rootwww sbin]# ls
nginx nginx_1.22.0 php-fpm9向旧的master发送USR2信号
查看旧的master进程PID为3142
[rootwww sbin]# ps -ef | grep -E CMD|nginx
UID PID PPID C STIME TTY TIME CMD
root 3142 1 0 12:34 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 3143 3142 0 12:34 ? 00:00:00 nginx: worker process
nginx 3144 3142 0 12:34 ? 00:00:00 nginx: worker process
nginx 3145 3142 0 12:34 ? 00:00:00 nginx: worker process
nginx 3146 3142 0 12:34 ? 00:00:00 nginx: worker process
nginx 3147 3142 0 12:34 ? 00:00:00 nginx: worker process
nginx 3148 3142 0 12:34 ? 00:00:00 nginx: worker process
nginx 3149 3142 0 12:34 ? 00:00:00 nginx: worker process
nginx 3150 3142 0 12:34 ? 00:00:01 nginx: worker process
root 10884 3006 0 14:09 pts/1 00:00:00 grep --colorauto -E CMD|nginx
[rootwww sbin]# ps axuw | head -1;ps axuw | grep nginx
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 3142 0.0 0.0 20532 688 ? Ss 12:34 0:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 3143 0.0 0.1 24292 2964 ? S 12:34 0:00 nginx: worker process
nginx 3144 0.0 0.1 24292 2972 ? S 12:34 0:00 nginx: worker process
nginx 3145 0.0 0.1 24292 2968 ? S 12:34 0:00 nginx: worker process
nginx 3146 0.0 0.1 24292 2972 ? S 12:34 0:00 nginx: worker process
nginx 3147 0.0 0.1 24292 2968 ? S 12:34 0:00 nginx: worker process
nginx 3148 0.0 0.1 24292 2968 ? S 12:34 0:00 nginx: worker process
nginx 3149 0.0 0.1 24292 2972 ? S 12:34 0:00 nginx: worker process
nginx 3150 0.0 0.1 24292 2972 ? S 12:34 0:01 nginx: worker process
root 10922 0.0 0.0 112676 984 pts/1 S 14:10 0:00 grep --colorauto nginx10确认nginx.pid位置
[rootwww run]# cd /usr/local/nginx[rootwww nginx]# find ./ -name nginx.pid
./logs/nginx.pid
[rootwww nginx]# cat ./logs/nginx.pid
3142(11) 热升级
[rootwww nginx]# kill -USR2 cat /usr/local/nginx/logs/nginx.pid 查看进程 [rootwww nginx]# ps -ef | grep -E CMD|nginx
UID PID PPID C STIME TTY TIME CMD
root 3142 1 0 12:34 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 3143 3142 0 12:34 ? 00:00:00 nginx: worker process
nginx 3144 3142 0 12:34 ? 00:00:00 nginx: worker process
nginx 3145 3142 0 12:34 ? 00:00:00 nginx: worker process
nginx 3146 3142 0 12:34 ? 00:00:00 nginx: worker process
nginx 3147 3142 0 12:34 ? 00:00:00 nginx: worker process
nginx 3148 3142 0 12:34 ? 00:00:00 nginx: worker process
nginx 3149 3142 0 12:34 ? 00:00:00 nginx: worker process
nginx 3150 3142 0 12:34 ? 00:00:01 nginx: worker process
root 12211 3142 0 14:32 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 12212 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12213 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12214 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12215 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12216 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12217 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12218 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12219 12211 0 14:32 ? 00:00:00 nginx: worker process
root 12238 3006 0 14:32 pts/1 00:00:00 grep --colorauto -E CMD|nginx
[rootwww nginx]# ps axuw | head -1;ps axuw | grep nginx
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 3142 0.0 0.0 20532 844 ? Ss 12:34 0:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 3143 0.0 0.1 24292 2964 ? S 12:34 0:00 nginx: worker process
nginx 3144 0.0 0.1 24292 2972 ? S 12:34 0:00 nginx: worker process
nginx 3145 0.0 0.1 24292 2968 ? S 12:34 0:00 nginx: worker process
nginx 3146 0.0 0.1 24292 2972 ? S 12:34 0:00 nginx: worker process
nginx 3147 0.0 0.1 24292 2968 ? S 12:34 0:00 nginx: worker process
nginx 3148 0.0 0.1 24292 2968 ? S 12:34 0:00 nginx: worker process
nginx 3149 0.0 0.1 24292 2972 ? S 12:34 0:00 nginx: worker process
nginx 3150 0.0 0.1 24292 2972 ? S 12:34 0:01 nginx: worker process
root 12211 0.0 0.0 20536 1692 ? S 14:32 0:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 12212 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12213 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12214 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12215 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12216 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12217 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12218 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12219 0.0 0.1 24296 2452 ? S 14:32 0:00 nginx: worker process
root 12249 0.0 0.0 112676 980 pts/1 R 14:32 0:00 grep --colorauto nginx发现有两个master进程第二个master进程就是新的主进程并且是作为老进程的子进程启动的。 并且nginx会将老的pid文件命名为nginx.pid.oldbin。
[rootwww logs]# ll | head -1 ;ll |grep nginx.pid
总用量 5904
-rw-r--r--. 1 root root 6 3月 19 14:32 nginx.pid
-rw-r--r--. 1 root root 5 3月 19 12:34 nginx.pid.oldbin[rootwww logs]# ll /usr/local/nginx/logs/nginx.pid.oldbin
-rw-r--r--. 1 root root 5 3月 19 12:34 /usr/local/nginx/logs/nginx.pid.oldbin查看PID
[rootwww logs]# cat nginx.pid
12211
[rootwww logs]# cat nginx.pid.oldbin
3142(12)向旧master发送winch信号
[rootwww logs]# kill -WINCH cat /usr/local/nginx/logs/nginx.pid.oldbin[rootwww logs]# ps -ef | grep -E CMD|nginx
UID PID PPID C STIME TTY TIME CMD
root 3142 1 0 12:34 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
root 12211 3142 0 14:32 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 12212 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12213 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12214 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12215 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12216 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12217 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12218 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12219 12211 0 14:32 ? 00:00:00 nginx: worker process
root 12887 3006 0 14:43 pts/1 00:00:00 grep --colorauto -E CMD|nginx
[rootwww logs]# ps axuw | head -1;ps axuw | grep nginx
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 3142 0.0 0.0 20532 844 ? Ss 12:34 0:00 nginx: master process /usr/local/nginx/sbin/nginx
root 12211 0.0 0.0 20536 1692 ? S 14:32 0:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 12212 0.0 0.1 24296 2968 ? S 14:32 0:00 nginx: worker process
nginx 12213 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12214 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12215 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12216 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12217 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12218 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12219 0.0 0.1 24296 2452 ? S 14:32 0:00 nginx: worker process
root 12899 0.0 0.0 112676 984 pts/1 R 14:43 0:00 grep --colorauto nginx平滑关闭旧master的worker进程 13向旧master发送QUIT信号
[rootwww logs]# kill -QUIT cat /usr/local/nginx/logs/nginx.pid.oldbin[rootwww logs]# ps -ef | grep -E CMD|nginx
UID PID PPID C STIME TTY TIME CMD
root 12211 1 0 14:32 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 12212 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12213 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12214 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12215 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12216 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12217 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12218 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12219 12211 0 14:32 ? 00:00:00 nginx: worker process
root 13069 3006 0 14:46 pts/1 00:00:00 grep --colorauto -E CMD|nginx
[rootwww logs]# ps axuw | head -1;ps axuw | grep nginx
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 12211 0.0 0.0 20536 1692 ? S 14:32 0:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 12212 0.0 0.1 24296 2968 ? S 14:32 0:00 nginx: worker process
nginx 12213 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12214 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12215 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12216 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12217 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12218 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12219 0.0 0.1 24296 2452 ? S 14:32 0:00 nginx: worker process
root 13084 0.0 0.0 112676 984 pts/1 R 14:46 0:00 grep --colorauto nginx14创建软连接
[rootwww logs]# ln -s /usr/local/nginx/sbin/nginx /bin/15验证
[rootwww logs]# nginx -V
nginx version: nginx/1.25.4
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
configure arguments: --prefix/usr/local/nginx --usernginx --groupnginx --with-http_stub_status_module6.Nginx 平滑回退
1替换nginx二进制文件
查看
[rootwww logs]# cd /usr/local/sbin
[rootwww sbin]# ls
nginx nginx_1.22.0 php-fpm替换
[rootwww sbin]# mv nginx nginx_1.25.4
[rootwww sbin]# ls
nginx_1.22.0 nginx_1.25.4 php-fpm
[rootwww sbin]# mv nginx_1.22.0 nginx
[rootwww sbin]# ls
nginx nginx_1.25.4 php-fpm2向旧的master发送USR2信号
查看PID
[rootwww logs]# cat /usr/local/nginx/logs/nginx.pid
12211[rootwww logs]# kill -USR2 cat /usr/local/nginx/logs/nginx.pid 查看进程 [rootwww logs]# ps -ef | grep -E CMD|nginx
UID PID PPID C STIME TTY TIME CMD
root 12211 1 0 14:32 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 12212 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12213 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12214 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12215 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12216 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12217 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12218 12211 0 14:32 ? 00:00:00 nginx: worker process
nginx 12219 12211 0 14:32 ? 00:00:00 nginx: worker process
root 14055 12211 0 15:02 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 14056 14055 0 15:02 ? 00:00:00 nginx: worker process
nginx 14057 14055 0 15:02 ? 00:00:00 nginx: worker process
nginx 14058 14055 0 15:02 ? 00:00:00 nginx: worker process
nginx 14059 14055 0 15:02 ? 00:00:00 nginx: worker process
nginx 14060 14055 0 15:02 ? 00:00:00 nginx: worker process
nginx 14061 14055 0 15:02 ? 00:00:00 nginx: worker process
nginx 14062 14055 0 15:02 ? 00:00:00 nginx: worker process
nginx 14063 14055 0 15:02 ? 00:00:00 nginx: worker process
root 14077 3006 0 15:02 pts/1 00:00:00 grep --colorauto -E CMD|nginx
[rootwww logs]# ps axuw | head -1;ps axuw | grep nginx
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 12211 0.0 0.0 20536 1692 ? S 14:32 0:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 12212 0.0 0.1 24296 2968 ? S 14:32 0:00 nginx: worker process
nginx 12213 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12214 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12215 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12216 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12217 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12218 0.0 0.1 24296 2712 ? S 14:32 0:00 nginx: worker process
nginx 12219 0.0 0.1 24296 2452 ? S 14:32 0:00 nginx: worker process
root 14055 0.0 0.0 20536 1696 ? S 15:02 0:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 14056 0.0 0.1 24296 2716 ? S 15:02 0:00 nginx: worker process
nginx 14057 0.0 0.1 24296 2716 ? S 15:02 0:00 nginx: worker process
nginx 14058 0.0 0.1 24296 2716 ? S 15:02 0:00 nginx: worker process
nginx 14059 0.0 0.1 24296 2716 ? S 15:02 0:00 nginx: worker process
nginx 14060 0.0 0.1 24296 2716 ? S 15:02 0:00 nginx: worker process
nginx 14061 0.0 0.1 24296 2716 ? S 15:02 0:00 nginx: worker process
nginx 14062 0.0 0.1 24296 2716 ? S 15:02 0:00 nginx: worker process
nginx 14063 0.0 0.1 24296 2456 ? S 15:02 0:00 nginx: worker process
root 14087 0.0 0.0 112676 984 pts/1 R 15:03 0:00 grep --colorauto nginxnginx会将老的pid文件命名为nginx.pid.oldbin。
[rootwww logs]# ll | head -1 ;ll |grep nginx.pid
总用量 5908
-rw-r--r--. 1 root root 6 3月 19 15:02 nginx.pid
-rw-r--r--. 1 root root 6 3月 19 14:32 nginx.pid.oldbin查看PID
[rootwww logs]# cat nginx.pid
14055
[rootwww logs]# cat nginx.pid.oldbin
122113向旧的master发送WINCH信号
[rootwww logs]# kill -WINCH cat /usr/local/nginx/logs/nginx.pid.oldbin查看进程
[rootwww logs]# ps -ef | grep -E CMD|nginx
UID PID PPID C STIME TTY TIME CMD
root 12211 1 0 14:32 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
root 14055 12211 0 15:02 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 14056 14055 0 15:02 ? 00:00:00 nginx: worker process
nginx 14057 14055 0 15:02 ? 00:00:00 nginx: worker process
nginx 14058 14055 0 15:02 ? 00:00:00 nginx: worker process
nginx 14059 14055 0 15:02 ? 00:00:00 nginx: worker process
nginx 14060 14055 0 15:02 ? 00:00:00 nginx: worker process
nginx 14061 14055 0 15:02 ? 00:00:00 nginx: worker process
nginx 14062 14055 0 15:02 ? 00:00:00 nginx: worker process
nginx 14063 14055 0 15:02 ? 00:00:00 nginx: worker process
root 14290 3006 0 15:06 pts/1 00:00:00 grep --colorauto -E CMD|nginx
[rootwww logs]# ps axuw | head -1;ps axuw | grep nginx
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 12211 0.0 0.0 20536 1692 ? S 14:32 0:00 nginx: master process /usr/local/nginx/sbin/nginx
root 14055 0.0 0.0 20536 1696 ? S 15:02 0:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 14056 0.0 0.1 24296 2716 ? S 15:02 0:00 nginx: worker process
nginx 14057 0.0 0.1 24296 2716 ? S 15:02 0:00 nginx: worker process
nginx 14058 0.0 0.1 24296 2716 ? S 15:02 0:00 nginx: worker process
nginx 14059 0.0 0.1 24296 2716 ? S 15:02 0:00 nginx: worker process
nginx 14060 0.0 0.1 24296 2716 ? S 15:02 0:00 nginx: worker process
nginx 14061 0.0 0.1 24296 2716 ? S 15:02 0:00 nginx: worker process
nginx 14062 0.0 0.1 24296 2716 ? S 15:02 0:00 nginx: worker process
nginx 14063 0.0 0.1 24296 2456 ? S 15:02 0:00 nginx: worker process
root 14305 0.0 0.0 112676 984 pts/1 R 15:06 0:00 grep --colorauto nginx4向旧的master发送QUIT信号
[rootwww logs]# kill -QUIT cat /usr/local/nginx/logs/nginx.pid.oldbin查看进程
[rootwww logs]# ps -ef | grep -E CMD|nginx
UID PID PPID C STIME TTY TIME CMD
root 14055 1 0 15:02 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 14056 14055 0 15:02 ? 00:00:00 nginx: worker process
nginx 14057 14055 0 15:02 ? 00:00:00 nginx: worker process
nginx 14058 14055 0 15:02 ? 00:00:00 nginx: worker process
nginx 14059 14055 0 15:02 ? 00:00:00 nginx: worker process
nginx 14060 14055 0 15:02 ? 00:00:00 nginx: worker process
nginx 14061 14055 0 15:02 ? 00:00:00 nginx: worker process
nginx 14062 14055 0 15:02 ? 00:00:00 nginx: worker process
nginx 14063 14055 0 15:02 ? 00:00:00 nginx: worker process
root 14371 3006 0 15:07 pts/1 00:00:00 grep --colorauto -E CMD|nginx
[rootwww logs]# ps axuw | head -1;ps axuw | grep nginx
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 14055 0.0 0.0 20536 1696 ? S 15:02 0:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 14056 0.0 0.1 24296 2716 ? S 15:02 0:00 nginx: worker process
nginx 14057 0.0 0.1 24296 2716 ? S 15:02 0:00 nginx: worker process
nginx 14058 0.0 0.1 24296 2716 ? S 15:02 0:00 nginx: worker process
nginx 14059 0.0 0.1 24296 2716 ? S 15:02 0:00 nginx: worker process
nginx 14060 0.0 0.1 24296 2716 ? S 15:02 0:00 nginx: worker process
nginx 14061 0.0 0.1 24296 2716 ? S 15:02 0:00 nginx: worker process
nginx 14062 0.0 0.1 24296 2716 ? S 15:02 0:00 nginx: worker process
nginx 14063 0.0 0.1 24296 2456 ? S 15:02 0:00 nginx: worker process
root 14377 0.0 0.0 112676 984 pts/1 R 15:07 0:00 grep --colorauto nginx5验证
已恢复之前版本
[rootwww logs]# nginx -V
nginx version: IIS777
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
configure arguments: --prefix/usr/local/nginx --usernginx --groupnginx --with-http_stub_status_module二、问题
1.kill命令的信号有哪些
1查看信号
[rootwww ~]# kill -l1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1
11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM
16) SIGSTKFLT 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP
21) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ
26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO 30) SIGPWR
31) SIGSYS 34) SIGRTMIN 35) SIGRTMIN1 36) SIGRTMIN2 37) SIGRTMIN3
38) SIGRTMIN4 39) SIGRTMIN5 40) SIGRTMIN6 41) SIGRTMIN7 42) SIGRTMIN8
43) SIGRTMIN9 44) SIGRTMIN10 45) SIGRTMIN11 46) SIGRTMIN12 47) SIGRTMIN13
48) SIGRTMIN14 49) SIGRTMIN15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12
53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9 56) SIGRTMAX-8 57) SIGRTMAX-7
58) SIGRTMAX-6 59) SIGRTMAX-5 60) SIGRTMAX-4 61) SIGRTMAX-3 62) SIGRTMAX-2
63) SIGRTMAX-1 64) SIGRTMAX2.平滑升级与回退的信号
1信号 信号 数字 含义 QUIT 3 关闭 HUP 1 重启 USR1 10 重新打开日志文件repon USR2 12 平滑升级可执行的二进制程序 WINCH 28 平滑关闭worker进程