CentOS 6.9 Nginx 编译安装shell
系统: CentOS 6.9 x64 mini
Nginx: nginx1.12.2
安装目录 : /www/server/nginx
源文件目录 : /www/soft
这里没有创建系统服务,
#!/bin/sh
# Auther: Mr.G
# QQ:825312600
# Web: http://www.gaobiao.me
# Mail:cmaoge@126.com
# Crate Data:2017.12.08
# Edit Date: 2017.12.08
# Nginx Install For CentOS
##首先安装必要的库
yum -y install gcc gcc-c++ automake autoconf libtool make pcre pcre-devel zlib zlib-devel openssl openssl-devel#需要提前下载 pcre zlib openssl 并解压
tar zxvf pcre-8.41.tar.gz
tar zxvf zlib-1.2.11.tar.gz
tar zxvf openssl-1.1.0g.tar.gzmkdir -p /www/server/nginx
chmod -R 775 /www/server/nginx/
groupadd nginx
useradd -s /sbin/nologin -M -g nginx nginx
chown -R nginx:nginx /www/server/nginxmkdir -p /www/server/nginx/temp/client_body
mkdir -p /www/server/nginx/temp/proxy
mkdir -p /www/server/nginx/temp/fastcgi
mkdir -p /www/server/nginx/temp/uwsgi
mkdir -p /www/server/nginx/temp/scgicd nginx-1.12.2
./configure --user=nginx --group=nginx \
--prefix=/www/server/nginx \
--sbin-path=/www/server/nginx/sbin/nginx \
--conf-path=/www/server/nginx/conf/nginx.conf \
--error-log-path=/www/server/nginx/logs/error.log \
--http-log-path=/www/server/nginx/logs/access.log \
--pid-path=/www/server/nginx/nginx.pid \
--lock-path=/www/server/nginx/nginx.lock \
--with-openssl=/www/soft/openssl-1.1.0g/ \
--with-pcre=/www/soft/pcre-8.41/ \
--with-zlib=/www/soft/zlib-1.2.11/ \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--http-client-body-temp-path=/www/server/nginx/temp/client_body \
--http-proxy-temp-path=/www/server/nginx/temp/proxy \
--http-fastcgi-temp-path=/www/server/nginx/temp/fastcgi \
--http-uwsgi-temp-path=/www/server/nginx/temp/uwsgi \
--http-scgi-temp-path=/www/server/nginx/temp/scgimake && make install
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
iptables -I INPUT -p tcp --dport 443 -j ACCEPTservice iptables save
service iptables restart
service iptables status#检测配置
./nginx -t#停止nginx
./nginx -s stop#启动 nginx
./nginx#重新加载配置
./nginx -s reload
网友评论