没有合适的资源?快使用搜索试试~ 我知道了~
nginx网站监控的相关脚本
资源推荐
资源详情
资源评论
nginx 网站监控的相关脚本
1.生产环境监控 nginx 服务实战案例:(监控 nginx 服务是否正常启动,如果未正常启动,异地重启 nginx 服务)(异地)
方法 1):用 nmap 命令扫描对方机器 80 端口,根据扫描情况判断对方服务是否开启
先让 nginx 服务器(192.168.40.139)和监控脚本机器(192.168.40.137)通过秘钥建立连接(之后可以非交互连接):
在 nginx 服务器(192.168.40.139)上:
[root@localhost ~]# /etc/init.d/sshd start
[root@localhost ~]# /etc/init.d/sshd status
在监控脚本机器(192.168.40.137)上:
[root@localhost ~]# /etc/init.d/postfix status
master (pid 1720) is running...
[root@localhost ~]# ls /root/.ssh/
为空
[root@localhost ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase): //不用输
Enter same passphrase again: //不用输
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
d4:b1:44:1e:a9:8d:aa:36:1e:71:22:f4:c1:02:17:0c root@localhost.localdomain
The key's randomart image is:
+--[ RSA 2048]----+
|Eoo. .=. |
| o.. +.+ |
| o o .++ |
| . o . .o . |
| . + ..S |
| . +. |
| .. |
| +. |
| o.. |
+-----------------+
[root@localhost ~]# ls /root/.ssh/
id_rsa id_rsa.pub
[root@localhost ~]# ssh-copy-id -i /root/.ssh/id_rsa.pub 192.168.40.139
输入对方的 root 密码:123456 //第一次建立连接需要输入对方密码
[root@localhost ~]# ssh root@192.168.40.139 //此后再想连接对方机器,就不需输密码了
即可连接对方机器,登录成功
在 nginx 服务器(192.168.40.139)上:(一键源码安装 nginx 服务并开发启停脚本)
[root@localhost ~]# mkdir /nginx
rz 上传 nginx 1.13.6 源码包到/nginx /目录下
[root@localhost ~]# ls /nginx/
nginx-1.13.6.tar.gz
[root@localhost ~]# cat nginx1.13.6_install.sh #一键安装脚本
#!/bin/bash
LANG=en_US.UTF-8
rpm -q gcc ||yum -y install gcc
rpm -q gcc-c++ || yum -y install gcc-c++
rpm -q openssl-devel || yum -y install openssl-devel
rpm -q zlib-devel || yum -y install zlib-devel
rpm -q pcre-devel || yum -y install pcre-devel
useradd nginx &> /dev/null
cd /nginx/
tar -zxf nginx-1.13.6.tar.gz
cd nginx-1.13.6
./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_ssl_module
make && make install
/usr/local/nginx/sbin/nginx -t #检查语法是否正确
/usr/local/nginx/sbin/nginx
netstat -anptu |grep :80
wq
[root@localhost ~]# sh nginx1.13.6_install.sh
一键安装中……
资源评论
运维实战帮
- 粉丝: 421
- 资源: 452
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功