服务管理
进程管理
准备工作--安装nginx服务
nginx网站服务器 端口:80
安装: systemctl status nginx
服务管理-systemctl
centos 7:systemctl centos 6:service
启动: systemctl start nginx
停止: systemctl stop nginx
重启: systemctl restart nginx
重载: systemctl reload nginx
状态: systemctl status nginx
开机自启: systemctl enable ninix
开机禁止启动: systemctl disable nginx
服务验证
netstat查看端口 tcp:-anlpt udp: -anlpu
网站服务器默认端口: 80
[root@myserver ~]# netstat -anlpt | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 110041/nginx: maste
tcp6 0 0 :::80 :::* LISTEN 110041/nginx: maste
[root@myserver ~]#
进程管理
ps查看进程状态
[root@myserver ~]# ps aux | grep nginx
root 110041 0.0 0.4 118668 7608 ? Ss 04:44 0:00 nginx: master process /usr/sbin/nginx
nginx 110054 0.0 0.4 150016 7596 ? S 04:44 0:00 nginx: worker process
root 115623 0.0 0.0 12108 1084 pts/0 S+ 14:18 0:00 grep --color=auto nginx
[root@myserver ~]#
kill停止进程, kill PID , -9 强制停止, -15 发送信号稳定停止
kill pid
kill -9 pid
kill -15 pid
killall nginx ##停止所有nginx相关进程
top查看系统所有进程
[root@myserver ~]# top
top - 14:28:16 up 5 days, 21:56, 1 user, load average: 0.02, 0.01, 0.00
Tasks: 258 total, 1 running, 257 sleeping, 0 stopped, 0 zombie
%Cpu(s): 1.0 us, 2.3 sy, 0.0 ni, 96.0 id, 0.0 wa, 0.7 hi, 0.0 si, 0.0 st
MiB Mem : 1800.6 total, 156.4 free, 909.1 used, 735.1 buff/cache
MiB Swap: 2048.0 total, 1706.0 free, 342.0 used. 685.5 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2185 root 20 0 2927232 200880 53032 S 2.7 10.9 4:08.15 gnome-s+
2790 root 20 0 553244 36832 24044 S 0.7 2.0 0:13.64 gnome-t+
114129 root 20 0 204924 31872 9948 S 0.3 1.7 0:05.60 sssd_kcm
1 root 20 0 182428 10876 6852 S 0.0 0.6 0:09.04 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.06 kthreadd
3 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_gp
4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_par+
6 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker+
8 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mm_perc+
9 root 20 0 0 0 0 S 0.0 0.0 0:02.47 ksoftir+
10 root 20 0 0 0 0 I 0.0 0.0 0:03.07 rcu_sch+
11 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migrati+
12 root rt 0 0 0 0 S 0.0 0.0 0:00.06 watchdo+
13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/0
15 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmp+
16 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 netns
查看本地ip
ipconfig