• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

0x1cc4

Youth means limitless possibilities. 年轻就是无限的可能。
  • 订阅
  • 管理

公告

View Post

Ubuntu系统上安装Nginx服务器以及使用方法

1、删除nginx,–purge包括配置文件

sudo apt-get --purge remove nginx

2、自动移除全部不使用的软件包

sudo apt-get autoremove

3、罗列出与nginx相关的软件

dpkg --get-selections|grep nginx

执行结果
stephen@stephen-OptiPlex-390:~$ dpkg --get-selections|grep nginx
nginx                       install
nginx-common                    install
nginx-core                  install

4、删除1.3查询出与nginx有关的软件

sudo apt-get --purge remove nginx
sudo apt-get --purge remove nginx-common
sudo apt-get --purge remove nginx-core

5、查看nginx正在运行的进程,如果有就kill掉

ps -ef |grep nginx

看下nginx还有没有启动,一般执行完1后,nginx还是启动着的,如下:

stephen@stephen-OptiPlex-390:~$ ps -ef |grep nginx
root      7875  2317  0 15:02 ?        00:00:00 nginx: master process /usr/sbin/nginx
www-data  7876  7875  0 15:02 ?        00:00:00 nginx: worker process
www-data  7877  7875  0 15:02 ?        00:00:00 nginx: worker process
www-data  7878  7875  0 15:02 ?        00:00:00 nginx: worker process
www-data  7879  7875  0 15:02 ?        00:00:00 nginx: worker process
stephen   8321  3510  0 15:20 pts/0    00:00:00 grep --color=auto nginx

kill nginx进程

sudo kill  -9  7875 7876 7877 7879

全局查找与nginx相关的文件

sudo  find  /  -name  nginx*

依依删除4列出的所有文件

sudo rm -rf file

这样就彻底删除nginx了

再次重装

sudo apt-get update
sudo apt-get install nginx

之后打开ip地址就可以访问到 Welcome to nginx!

基本命令的使用***********

启动nginx:/etc/nginx/

sudo nginx -c /etc/nginx/nginx.conf

停止nginx

nginx -s stop

重新启动-(更改配制文件)

nginx -s reload
* 如有不正确的欢迎评论指出

本文来自博客园,作者:0x1cc4,转载请注明原文链接:https://www.cnblogs.com/0x1cc4/p/17917005.html

posted on 2018-11-26 16:46  0x1cc4  阅读(10)  评论(0)    收藏  举报  来源

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3