首页 > 系统相关 >Linux 安装Nginx集群测试

Linux 安装Nginx集群测试

时间:2022-12-31 22:34:15浏览次数:58  
标签:00 nginx 0.0 Nginx 集群 usr Linux root localhost

5.1 停止Nginx服务的四种方法

  • 从容停止服务

  这种方法较stop相比就比较温和一些了,需要进程完成当前工作后再停止。

nginx -s quit
  • 立即停止服务

  这种方法比较强硬,无论进程是否在工作,都直接停止进程。

nginx -s stop
  • systemctl 停止

  systemctl属于Linux命令

systemctl stop nginx.service
  • killall 方法杀死进程

  直接杀死进程,在上面无效的情况下使用,态度强硬,简单粗暴!

killall nginx

5.2.启动Nginx

  1.nginx直接启动

nginx

  2.systemctl命令启动

systemctl start nginx.service

  3.查看启动后记录

ps aux | grep nginx

  4.重启Nginx服务

systemctl restart nginx.service

  5.重新载入配置文件
  当有系统配置文件有修改,用此命令,建议不要停止再重启,以防报错!

nginx -s reload

  6.查看端口号

netstat -tlnp

6 卸载Nginx

6.1 首先输入命令 ps -ef | grep nginx检查一下nginx服务是否在运行。

[root@localhost /]# ps -ef |grep nginx
root 3163 2643 0 14:08 tty1 00:00:00 man nginx
root 5427 1 0 14:50 ? 00:00:00 nginx: master process nginx
nginx 5428 5427 0 14:50 ? 00:00:00 nginx: worker process
root 5532 2746 0 14:52 pts/0 00:00:00 grep --color=auto nginx

6.2 停止Nginx服务

[root@localhost /]# /usr/sbin/nginx -s stop
[root@localhost /]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1261/sshd
tcp6 0 0 :::111 :::* LISTEN 1/systemd
tcp6 0 0 :::22 :::* LISTEN 1261/sshd

6.3 查找、删除Nginx相关文件

  • 查看Nginx相关文件:whereis nginx
[root@localhost /]# whereis nginx
nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx /usr/share/man/man8/nginx.8.gz /usr/share/man/man3/nginx.3pm.gz
  • find查找相关文件
[root@localhost /]# find / -name nginx
/usr/lib64/perl5/vendor_perl/auto/nginx
/usr/lib64/nginx
/usr/share/nginx
/usr/sbin/nginx
/etc/logrotate.d/nginx
/etc/nginx
/var/lib/nginx
/var/log/nginx
  • 依次删除find查找到的所有目录:rm -rf /usr/sbin/nginx

6.4 再使用yum清理

[root@localhost /]# yum remove nginx
依赖关系解决

======================================================================================================
Package 架构 版本 源 大小
======================================================================================================
正在删除:
nginx x86_64 1:1.12.2-3.el7 @epel 1.5 M
为依赖而移除:
nginx-all-modules noarch 1:1.12.2-3.el7 @epel 0.0
nginx-mod-http-geoip x86_64 1:1.12.2-3.el7 @epel 21 k
nginx-mod-http-image-filter x86_64 1:1.12.2-3.el7 @epel 24 k
nginx-mod-http-perl x86_64 1:1.12.2-3.el7 @epel 54 k
nginx-mod-http-xslt-filter x86_64 1:1.12.2-3.el7 @epel 24 k
nginx-mod-mail x86_64 1:1.12.2-3.el7 @epel 99 k
nginx-mod-stream x86_64 1:1.12.2-3.el7 @epel 157 k

事务概要
======================================================================================================
移除 1 软件包 (+7 依赖软件包)

安装大小:1.9 M
是否继续?[y/N]:
  • ok nginx 卸载完成!

 

 

6.1 首先输入命令 ps -ef | grep nginx检查一下nginx服务是否在运行。

[root@localhost /]# ps -ef |grep nginx
root 3163 2643 0 14:08 tty1 00:00:00 man nginx
root 5427 1 0 14:50 ? 00:00:00 nginx: master process nginx
nginx 5428 5427 0 14:50 ? 00:00:00 nginx: worker process
root 5532 2746 0 14:52 pts/0 00:00:00 grep --color=auto nginx

6.2 停止Nginx服务

[root@localhost /]# /usr/sbin/nginx -s stop
[root@localhost /]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1261/sshd
tcp6 0 0 :::111 :::* LISTEN 1/systemd
tcp6 0 0 :::22 :::* LISTEN 1261/sshd

标签:00,nginx,0.0,Nginx,集群,usr,Linux,root,localhost
From: https://blog.51cto.com/u_14879850/5982430

相关文章

  • linux 安装redis
    一,redis的官网:https://redis.io///下载wgethttps://download.redis.io/releases/redis-7.0.7.tar.gz二、安装准备//安装gccgcc--versionyuminstallgcc/......
  • centos8使用kubeadm搭建高可用k8s集群
    kubeadm是官方社区推出的一个用于快速部署kubernetes集群的工具。这个工具能通过两条指令完成一个kubernetes集群的部署:#创建一个Master节点kubeadminit#将一个......
  • websocket 多个nginx转发
    官网http://nginx.org/en/docs/http/websocket.html第一个nginxserver{listen6794;root/mnt/dist;location/analyze/{prox......
  • Nginx 安装 SSL 配置 HTTPS 超详细完整全过程
    在Nginx或Tengine服务器上安装证书说到 ​​Nginx​​​ 服务器,个人认为最大特点就是轻量级和高性能。通过在几台不同的服务器上进行测试,发现它的并发能力特别强,并且相对......
  • Nginx 出现 403 Forbidden 最终解决方法
    Nginx出现403Forbidden最终解决步骤一:检查目录权限。权限不足的就加个权限吧。例子:chmod-R755/var/www步骤二:打开nginx.conf例子:vim/etc/nginx/nginx.conf把user......
  • Docker 安装Nginx并实现挂载
    1、查看镜像来源:dockersearchnginx$dockersearchnginxNAMEDESCRIPTIONSTARSOFFICIALAUTOMATEDn......
  • Nginx 代理websocket连接上限
    一.结论 1.nginx最多只能维持(65535*后端服务器IP个数)条websocket的长连接,如果后端websocket服务器IP只有一个,那么就只能最多支持65535条连接。瓶颈就产生在了nginx上......
  • linux 中对带有空格、括号的文件进行重命名
     001、[root@PC1test]#lsSraRunInfo(2).csv[root@PC1test]#mvSraRunInfo(2).csvnew_name##复制文件名重命名报错-bash:syntaxerrornearunexpe......
  • linux 中删除文件名中的括号
     001、[root@PC1test]#ls##测试数据SraRunInfo(1).csvSraRunInfo(2).csvSraRunInfo(3).csvSraRunInfo(4).csvSraRunInfo(5).......
  • 【K8S】MAC搭建K8S集群
    参考资料​​全网最系统、最清晰!深入微服务架构——Docker和K8s详解-哔哩哔哩​​​​Mac+Docker+K8S本地搭建K8S集群_GoLang成长之​​Mac系统安装k8s集群_51CTO博......