Nginx 安装 ngx_http_google_filter_module 模块

发布时间: 更新时间: 总字数:222 阅读时间:1m 作者: 分享

Nginx 安装 ngx_http_google_filter_module 模块。

Centos 安装

DOMAIN=g.jcloud.xyz

yum -y install build-essential git gcc g++ gcc-g++ make && mkdir $DOMAIN && cd $DOMAIN && git clone https://github.com/cuber/ngx_http_google_filter_module && git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module && wget "http://nginx.org/download/nginx-1.10.2.tar.gz" && tar xzvf nginx-1.10.2.tar.gz && wget "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz" && tar xzvf pcre-8.41.tar.gz && wget "http://zlib.net/zlib-1.2.11.tar.gz" && tar xzvf zlib-1.2.11.tar.gz &&  wget "https://www.openssl.org/source/openssl-1.1.0c.tar.gz" && tar xzvf openssl-1.1.0c.tar.gz && cd nginx-1.10.2

./configure --prefix=/opt/nginx-1.10.2 --with-pcre=../pcre-8.41 --with-openssl=../openssl-1.1.0c --with-zlib=../zlib-1.2.11 --with-http_ssl_module --add-module=../ngx_http_google_filter_module --add-module=../ngx_http_substitutions_filter_module

make && make install

启动:

[root@xiexianbin_cn ~]# systemctl cat nginx-google.service
# /usr/lib/systemd/system/nginx-google.service
[Unit]
Description=The nginx-google HTTP and reverse proxy server
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
#PIDFile=/run/nginx-google.pid
# Nginx will fail to start if /run/nginx-google.pid already exists but has the wrong
# SELinux context. This might happen when running `nginx -t` from the cmdline.
# https://bugzilla.redhat.com/show_bug.cgi?id=1268621
#ExecStartPre=/usr/bin/rm -f /run/nginx-google.pid
ExecStartPre=/opt/nginx-1.10.2/sbin/nginx -t -c /opt/nginx-1.10.2/conf/nginx.conf
ExecStart=/opt/nginx-1.10.2/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=process
PrivateTmp=true

[Install]
WantedBy=multi-user.target
[root@xiexianbin_cn ~]# 

Ubuntu 安装

apt-get -y install build-essential git gcc g++ make && mkdir wen.lu && cd wen.lu && git clone https://github.com/cuber/ngx_http_google_filter_module && git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module && wget "http://nginx.org/download/nginx-1.10.2.tar.gz" && tar xzvf nginx-1.10.2.tar.gz && wget "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz" && tar xzvf pcre-8.39.tar.gz && wget "http://zlib.net/zlib-1.2.8.tar.gz" && tar xzvf zlib-1.2.8.tar.gz &&  wget "https://www.openssl.org/source/openssl-1.1.0c.tar.gz" && tar xzvf openssl-1.1.0c.tar.gz && cd nginx-1.10.2

./configure .--prefix=/opt/nginx-1.10.2 .--with-pcre=../pcre-8.39 .--with-openssl=../openssl-1.1.0c .--with-zlib=../zlib-1.2.8 .--with-http_ssl_module .--add-module=../ngx_http_google_filter_module .--add-module=../ngx_http_substitutions_filter_module && make

make install

/opt/nginx-1.10.2/sbin/nginx

完毕。

Home Archives Categories Tags Docs