脚本内容
#!/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