/
#!/bin/bash
ver=1.26.1
if [ ! -e /usr/local/nginx ];then
mkdir /usr/local/nginx
fi
yum -y install readline-devel pcre-devel openssl-devel perl \
gcc zlib zlib-devel wget automake
wget http://nginx.org/download/nginx-$ver.tar.gz
cd nginx-$ver
./configure --with-stream --with-http_ssl_module --prefix=/usr/local/nginx
make && make install
mkdir /usr/local/nginx/conf/vhosts
sed -i '116s#^$# include /usr/local/nginx/conf/vhosts/*.conf;#' /usr/local/nginx/conf/nginx.conf
cat> /usr/lib/systemd/system/nginx.service <<EOF
[Unit]
Description=nginx - high performance web server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable --now nginx
/usr/local/nginx/sbin/nginx -v
Nginx二进制编译部署指南

被折叠的 条评论
为什么被折叠?



