下载源码
wget http://artfiles.org/openssl.org/source/openssl-1.1.0e.tar.gz
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz
wget http://zlib.net/zlib-1.2.11.tar.gz
git clone https://github.com/nginx/nginx.git
git clone https://github.com/cuber/ngx_http_google_filter_module
git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module
pcre版本不要太新,否则后面编译会有问题。
./auto/configure --with-pcre=../pcre-8.39 --with-openssl=../openssl-1.1.0e --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 -j 4
sudo make install
nginx默认安装目录是/usr/local/,
可执行文件/usr/local/nginx/sbin/nginx
,
配置文件/usr/local/nginx/conf/nginx.conf
server {
server_name localhost;
listen 80;
resolver 8.8.8.8;
location / {
google on;
}
}
sudo /usr/local/nginx/sbin/nginx