#!/bin/bash
read -p "请选择您的nginx的安装方式;(1)yum方式安装;(2)源码编译安装;请选择(1 or 2):" NGINXINSTALL
if [ $NGINXINSTALL ==1 ];then
yum install nginx -y
fi
if [[ $NGINXINSTALL == 2 ]];then
yum -y install gcc gcc-c++ make zlib-devel pcre-devel openssl-devel
mkdir -p /date/download
cd /date/download/
wget http://nginx.org/download/nginx-1.24.0.tar.gz
tar -xzvf nginx-1.24.0.tar.gz
cd nginx-1.24.0
useradd -r www; ./configure --user=wwww --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make
make install
fi
case $? in
0)
echo -e "nginx install succefull"
;;
1)
echo -e "install error"
;;
esac
# CREATE nginx.service
echo '[Unit]
Description=nginx
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
PrivateTmp=true
[Install]
WantedBy=multi-user.target' > /lib/systemd/system/nginx.service
systemctl daemon-reload
echo 'user www www;' >> /usr/local/nginx/conf/nginx.conf ####待完善,因为会追加到最后的}之外,需要手动再修改。
#start Nginx
systemctl start nginx
systemctl enable nginx
没有合适的资源?快使用搜索试试~ 我知道了~
keepalived+haproxy+nginx-脚本
共8个文件
sh:8个
需积分: 5 0 下载量 33 浏览量
2024-04-29
16:11:55
上传
评论
收藏 4KB RAR 举报
温馨提示
keepalived+haproxy+nginx-脚本
资源推荐
资源详情
资源评论
收起资源包目录
keepalived+haproxy+nginx-脚本.rar (8个子文件)
keepalived+haproxy+nginx-脚本
haproxy_service.sh 607B
check_haproxy.sh 493B
keepalived_backup_conf.sh 624B
install_keepalived.sh 437B
install_nginx.sh 1KB
keepalived_master_conf.sh 974B
set_haproxy_cfg.sh 949B
install_haproxy.sh 323B
共 8 条
- 1
资源评论
lht631935612
- 粉丝: 21
- 资源: 106
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功