一键安装Nginx

脚本内容

#!/bin/bash
user=$(whoami)
if [ $user == “root” ];then
echo “root is right”
else
echo “use root please”
exit 0
fi
#useradd
id qjh &>/dev/null||useradd qjh
echo ‘123456’|passwd qjh --stdin
mkdir -p /nginx
cd /nginx
#download nginx
curl -O http://nginx.org/download/nginx-1.12.1.tar.gz
#extract
tar -xvf ./nginx-1.12.1.tar.gz
#download relypackage
yum -y install gcc gcc-c++ autoconf automake make
yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel
#install nginx
cd nginx-1.12.1
./configure --prefix=/usr/local/nginx --with-http_ssl_module --user=qjh --group=qjh --with-http_stub_status_module --with-http_gzip_static_module --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log
sed -i ‘s/-Werror/ /’ /nginx/nginx-1.12.1/objs/Makefile
make && make install

echo “PATH=$PATH:/usr/local/nginx/sbin” >>/root/.bashrc
source /root/.bashrc
/usr/local/nginx/sbin/nginx
####stop firewall
service firewalld stop
systemctl disable firewalld
sed -i “/^SELINUX=/ s/enforcing/disabled/” /etc/selinux/config
lsof -i:80**

模块

–prefix=/usr/local/nginx
指定启动nginx的进程用户
–user=qjh
指定启动的组
–group=qjh
启用线程池的使用
–with-threads
启用构建将HTTPS协议支持添加
–with-http_ssl_module
将客户端地址更改为在指定的标头字段中发送的地址
–with-http_realip_module
支持构建提供对HTTP/2支持的模块
–with-http_v2_module
在FreeBSD和linux上使用异步文件I/O
–with-file-aio
该模块提供对基本状态信息的访问
–with-http_stub_status_module
构建通用TCP/UDP代理和负载均衡的流模块 - - -四层负载均衡的支持
–with-stream

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值