下载源码
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
报文如下:
后来了解到,可能是因为域名未备案的原因,被墙了。
但是他们怎么实现的呢,通过IP可以访问,通过域名无法访问,猜测是通过HTTP头部的HOST字段来检测的。