centos nginx安装脚本

参考安装脚本

#!/bin/bash
read -p "请输入你要定制的服务名称:" Servername
echo "开始安装依赖包..."
yum -y install zlib zlib-devel openssl openssl-devel pcre-devel gcc gcc-c++ autoconf automake
useradd -s /sbin/nologin -M nginx
if [ -e nginx-1.10.3.tar.gz ]
then
   tar -xvf nginx-1.10.3.tar.gz 
   cd nginx-1.10.3
   sed -i "s@\"nginx/\" NGINX_VERSION@\"$Servername\/\" NGINX_VERSION@g" src/core/nginx.h
   sed -i "s@\"Server: nginx\" CRLF@\"Server: $Servername\" CRLF@g" src/http/ngx_http_header_filter_module.c
   sed -i "s@\<hr\>\<center\>nginx\<\/center\>@\<hr\>\<center\>$Servername\<\/center\>@g"  src/http/ngx_http_special_response.c 
   ./configure --prefix=/opt/nginx   --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module  --with-http_gzip_static_module  --with-pcre
   make -j 4 && make install
   ln -s /optl/nginx/sbin/nginx /usr/sbin/
   nginx
   echo "Nginx安装完成"
   sleep 1 
   cp /opt/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak
   mkdir /etc/nginx
   sleep 1
   ln -s /opt/nginx/conf/*  /etc/nginx/
   sed -i "/\#tcp_nopush/a\    server_tokens  off\;" /opt/nginx/conf/nginx.conf
   nginx  -s reload 
else
  echo "请检查nginx安装包是否存在"
fi
  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值