#!/bin/bash
## install nginx
WORK_DIR=`mktemp -d`
apt install wget libpcre3 libpcre3-dev zlib1g-dev \
openssl libssl-dev libxml2 libxml2-dev libxslt-dev \
gcc make libgd-dev libgeoip-dev libpcre3-dev libperl-dev -y
cd $WORK_DIR
wget http://nginx.org/download/nginx-1.27.2.tar.gz
tar zxvf nginx-1.27.2.tar.gz && cd nginx-1.27.2
./configure --prefix=/opt/nginx --user=apache --group=apache \
--with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module \
--with-pcre --with-http_v2_module --with-http_dav_module \
--with-http_flv_module --with-http_realip_module --with-http_addition_module \
--with-http_xslt_module --with-http_sub_module --with-http_random_index_module \
--with-http_degradation_module --with-http_secure_link_module --with-http_perl_module \
--with-debug --with-file-aio --with-stream --with-ld-opt=-Wl,-E
make && make install
[ -d $WORK_DIR ] && rm $WORK_DIR -rf
## 添加nginx运行账户
cat /etc/passwd | grep apache
if [ $? -ne 0 ];then
groupadd apache
useradd -g apache -s /sbin/nologin -c "apache" apache
fi