shell脚本一键部署nginx
一键部署nginx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
#!/bin/bash systemctl stop firewalld && setenforce 0 #首先安装nginx的依赖环境 yum -y install gcc pcre-devel zlib-devel net-tools wget #解压nginx的安装包 if [ ! -d "/root/nginx-1.16.1" ]; then wget http: //nginx .org /download/nginx-1 .16.1. tar .gz tar -zxf nginx-1.16.1. tar .gz echo "压缩包已解压" else echo "此文件已存在" continue fi #进去文件开始检查环境 编译安装 if [ ! -d /usr/local/nginx ]; then cd /root/nginx-1 .16.1 && . /configure && make && make install else continue fi #判断是否nginx的端口被占用 pid_file= "/usr/local/nginx/logs/nginx.pid" if [ ! -e ${pid_file} ]; then echo "被占用的pid是:`cat ${pid_file}`" kill ` cat ${pid_file}` echo "服务被占用,已删掉" else echo "服务没有被占用" continue fi nginx= /usr/local/nginx/sbin/nginx #开始启动nginx read -p "请输入你接下来要做的操作:" action check(){ netstat -anptu | grep nginx if [ $? - eq 0 ]; then continue fi } case $action in start) netstat -anptu | grep nginx if [ $? - eq 0 ]; then continue else $nginx fi ;; stop) netstat -anptu | grep nginx if [ $? - eq 0 ]; then echo "nginx-server is already running nginx-server begin stop" $nginx -s stop else echo "nginx-server is not start" fi ;; reload) netstat -anptu | grep nginx if [ $? - eq 0 ]; then echo "nginx-server is already running nginx-server begin reload" $nginx -s reload else echo "nginx-server is not running now begin start nginx-server" $nginx $nginx -s reload fi ;; statue) check ;; *) echo "please enter{start|stop|reload|statue}" ;; esac ip=` /sbin/ifconfig -a| awk '{print $2}' | sed -n '2p' ` code=`curl -I -m 10 -o /dev/null -s -w %{http_code} http: // ${ip}` if [ $code - eq 200 ]; then echo "nginx-server is ok" else echo "nginx-server is not ok" fi |
shell脚本一键部署nginx的更多相关文章
- Shell脚本一键部署——源码编译安装MySQL及自动补全工具
Shell脚本一键部署--源码编译安装MySQL及自动补全工具 编译安装MySQL 1.软件包 Mysql安装包 将安装包拖至/opt目录下,编辑一个脚本文件,将以下内容复制进去,然后source或者 ...
- shell脚本一键安装nginx
依赖包安装包放在一起, 直接执行这个脚本就行. #!/bin/bash #--------------------------------------------------------------- ...
- shell脚本一键部署——Redis(直接复制执行)亲测100% 有效
首先所需软件包拖进目录,然后编辑一个脚本,复制一下脚本,source执行一下即可 #!/bin/bash echo -e "\033[31m =====正在验证当前为仅主机还是NAT模式== ...
- shell脚本一键部署lvs+keepalived
环境 两个调度器dr1.dr2,两台真实机rs1.rs2.两台真实机安装httpd,并编辑主页内容用于验证 vip="192.168.132.250"dr1="192.1 ...
- Tomcat集群 Nginx负载均衡 shell脚本实时监控Nginx
第一步,安装Tomcat 系统环境:Centos7 第1步:下载tomcat安装包 tomcat官网:https://tomcat.apache.org/ 第2步:安装包上传至linux中 第3步:下 ...
- 一键部署nginx 服务
一键部署nginx服务 老样子安装包都拖到opt里! 脚本如下 source 执行! #!/bin/bash #======编译安装nginx服务====== #安装所需开发包和编译环境.编译器 yu ...
- Centos 6.4上面用Shell脚本一键安装vsftpd
Centos 6.4上面用Shell脚本一键安装vsftpd install.sh #!/bin/bash if [ `uname -m` == "x86_64" ];then m ...
- Centos 6.4上面用Shell脚本一键安装mysql 5.6.15
Centos 6.4上面用Shell脚本一键安装mysql 5.6.15 #!/bin/bash if [ `uname -m` == "x86_64" ];then machi ...
- shell脚本一键同步集群时间
shell脚本一键同步集群时间 弋嘤捕大 椿澄辄 ψ壤 茇徜燕 ㄢ交涔沔 阚龇棚绍 テ趼蜱棣 灵打了个寒颤也没有去甩脱愣是拖着 喇吉辔 秋北酏崖 琮淄脸酷 茇呶剑 莲夤罱 陕遇骸淫 ...
随机推荐
- 输出1~n中1的个数
//输出1~n中1的个数,如f(1)=1,f(13)=6.通过测试,bymyself public class FindOnes{ public static void main(String arg ...
- struts2没有打印日志原因和No result defined for action XXXAction and result input
在项目中调用一个action的方法的时候发生了一个错误,但是在catalina.out和配置的log4j都没有打印异常,后来在执行的action中加了logger.error("XXXXX& ...
- [深度学习] 各种下载深度学习数据集方法(In python)
一.使用urllib下载cifar-10数据集,并读取再存为图片(TensorFlow v1.14.0) # -*- coding:utf-8 -*- __author__ = 'Leo.Z' imp ...
- Mongo Cursor
简介 在使用 Java 对数据库进行连接时,都会获取到一个 cursor ,cursor 实际指到的是我们查询数据库的query,而并不是 query 查询到的数据集. 此次在使用 mongo 的 c ...
- 解决idea无法显示中文候选框问题
第一:先找到idea安装目录,找到文件jre64,把它命名为“jre642”,也可以随意命名 第二步:找到Javaan安装目录下的jre ,把它复制到idea安装目录下,命名为“jre64”. 第三 ...
- SpringBoot 单文件和多文件上传
单.多文件上传:单文件上传使用upload.html ,多文件上传使用uploads.html 创建一个Springboot application, POM 中加入 spring-boot-star ...
- RabbitMq运行原理浅析
转载:https://blog.csdn.net/Evankaka/article/details/80977027 1.RabbitMq简介 AMQP,即Advanced Message Q ...
- CountDownLatch和CyclicBarrier的比较
1.CountDownLatch是线程组之间的等待,即一个(或多个)线程等待N个线程完成某件事情之后再执行:而CyclicBarrier则是线程组内的等待,即每个线程相互等待,即N个线程都被拦截之后, ...
- C++入门经典-例3.23-使用嵌套循环输出乘法口诀表
1:代码如下: // 3.23.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include <iomanip> #incl ...
- R实现pm2.5地图数据展示
使用rvest包抓取pm2.5静态页面数据,使用leafletCN包实现pm2.5数据的地图展示,代码如下所示: library(rvest) library(leafletCN) Sys.setlo ...