ubuntu 安装/卸载nginx及常用命令

安装命令

1
2
sudo apt- get  update #更新apt
sudo apt- get  install nginx  #安装nginx

 启动/重启/停止命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
一、
/etc/init.d/nginx start #启动
/etc/init.d/nginx reload #重启
/etc/init.d/nginx stop #停止
 
二、
service nginx start #启动
service nginx reload #重启
service nginx stop #停止
 
三、
快速停止
1.查看进程号ps -ef|grep nginx   2.kill -TERM 进程号 / kill -INT 进程号
四、
进入nginx安装目录sbin下
  ./nginx -s start  #启动
  ./nginx -s reload #重启
  ./nginx -s stop / ./nginx -s quit #停止/关闭

 卸载命令

1
2
3
4
5
6
7
sudo apt- get  remove nginx nginx-common # 卸载删除除了配置文件以外的所有文件。
 
sudo apt- get  purge nginx nginx-common # 卸载所有文件,包括删除配置文件。
 
sudo apt- get  autoremove # 在上面命令结束后执行,卸载删除Nginx的不再使用的依赖包。
 
  sudo apt- get  remove nginx-full nginx-common #卸载删除nginx-full nginx-common

 检测是否启动nginx

1
wget 127.0.0.1

  

猜你喜欢

转载自www.cnblogs.com/iceman-/p/9382414.html