./configure \
--prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_spdy_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module \
--add-module=../ngx_http_substitutions_filter_module \
--add-module=../ngx_http_google_filter_module
# upstream配置google的ip,ip可以通过 nslookup www.google.com 命令获取,
# 多运行几次nslookup会获取到多个IP,有助于避免触发google的防机器人检测。
upstream www.google.com {
    server  weight=;
    server  weight=;
    server  weight=;
    server  weight=;
    server  weight=;
    server  weight=;
    server  weight=;
    server  weight=;
    server  weight=;
    server  weight=;
    server  weight=;
    server  weight=;
}

# 这里将http的访问强制跳转到https,<domain.name>改为自己的域名。
server {
    listen ;
    server_name <domain.name>;
    # http to https
    location / {
          rewrite ^/(.*)$ https://<domain.name>$1 permanent;
    }
}

# https的设置
server {
    listen        ssl;
    server_name  <domain.name>;
    resolver 8.8.8.8;

    # SSL证书的设置,<path to ssl.xxx>改为自己的证书路径
    ssl on;
    ssl_certificate <path to ssl.crt>;
    ssl_certificate_key <path to ssl.key>;

    # 防止网络爬虫
    #forbid spider
    if ($http_user_agent ~* "qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|YoudaoBot|Sosospider|Sogou spider|Sogou web spider|MSNBot|ia_archiver|Tomato Bot")
    {
        return ;
    }

    # 禁止用其他域名或直接用IP访问,只允许指定的域名
    #forbid illegal domain
    if ( $host != "<domain.name>" ) {
        return ;
    }

    access_log  off;
    error_log   on;
    error_log  /var/log/nginx/google-proxy-error.log;

    # 编译时加了 ngx_http_google_filter_module 模块,location的设置就非常简单
    location / {
        google on;
    }
}

1、nginx 反向代理google

https://zhgcao.github.io/2016/06/09/nginx-reverse-proxy-google/

玩转 nginx 反向代理 Google  https://hack0nair.me/2014-10-25-how-to-setup-reverse-proxy-by-nginx/

如何升级Nginx到最新稳定版 http://www.cnblogs.com/terrysun/archive/2012/11/22/2782472.html

2、 需要安装的包,ubuntu、centos

参考: How to compile and install Nginx web server from source on Linux http://xmodulo.com/compile-install-nginx-web-server.html

ubuntu

$ sudo apt-get install build-essential zlib1g-dev libpcre3-dev libssl-dev libxslt1-dev libxml2-dev libgd2-xpm-dev libgeoip-dev libgoogle-perftools-dev libperl-dev

centos  

$ sudo yum install gcc-c++ pcre-devel zlib-devel make wget openssl-devel libxml2-devel libxslt-devel gd-devel perl-ExtUtils-Embed GeoIP-devel gperftools-devel

配置

$ .tar.gz
$ cd nginx-
$ ./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_spdy_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-http_perl_module --with-mail --with-mail_ssl_module --with-pcre --with-google_perftools_module --with-debug
$ make
$ sudo make install 

3、 nginx配置ssl加密(单双向认证、部分https)   http://seanlook.com/2015/05/28/nginx-ssl/

http://blog.chinaunix.net/xmlrpc.php?r=blog/article&uid=29791971&id=4702007

https ssl证书生成

Linux 生成SSL证书 供 nginx使用 http://www.jianshu.com/p/80a3d10e55f7

2、 https 使用非 443 端口

nginx 通过openssl配置https公网证书(非443端口下http与https共存)

http://481814.blog.51cto.com/471814/1835713

端口占用问题 : sudo netstat -anp | grep 80

nginx 反代理google的更多相关文章

  1. 建站第二步:简单配置Nginx反代理工具

    简单配置Nginx反代理工具 你要用你的域名能和服务器绑定就要用一些反代理工具 Nginx (engine x) 是一个高性能的HTTP和反向代理web服务器,极其优异的服务器软件,底层为C 来自某些 ...

  2. Nginx 反代理其他搜索引擎

    反向代理 反向代理(Reverse Proxy)方式是指以代理服务器来接受internet上的连接请求,然后将请求转发给内部网络上的服务器,并将从服务器上得到的结果返回给internet上请求连接的客 ...

  3. nginx 反向代理 google

    nginx的反向代理,google一直都是不容易打开的,如果你有一台位于国外的vps或者服务器,就可以轻松解决这个问题,这次的主角是nginx,nginx的反向代理现在已经发展很强大了,很多时候拿他来 ...

  4. .net core3.0部署Linux服务器 使用Docker容器和Nginx反代理教程

    本人刚接触.net core 由于公司项目需要部署在Linux上 近些日子学习和网上大面积搜教程 我在这给大家归拢归拢借鉴的教程做了套方案(我写的可以实现 但不一定是最好的 仅供参考) 我只用过cor ...

  5. (01-02) odoo8.0_Ubuntu14.04_nginx反代理设置

    作者:陈伟明联系 :  QQ 942923305 | 微信 toby942923305E-mail: cwm.win@hotmail.com============================== ...

  6. nginx反向代理实现均衡负载及调度方法

    http upstream配置参数: ngx_http_upstream_module模块将多个服务器定义成服务器组,而由proxy_pass, fastcgi_pass等指令进行引用 upstrea ...

  7. Linux系统之LNMP及nginx反向代理实现

    1.编译安装LNMP,并安装wordpress 首先准备环境,编译安装LNMP可以是多台主机,也可以是单台主机,把nginx,mysql,php都集中安装在一个主机上:我这里以一台主机为例吧!! 一. ...

  8. nginx正向代理,反向代理,透明代理(总结)

    1正向代理 正向代理,也就是传说中的代理,他的工作原理就像一个跳板, 简单的说, 我是一个用户,我访问不了某网站,但是我能访问一个代理服务器 这个代理服务器呢,他能访问那个我不能访问的网站 于是我先连 ...

  9. (34)odoo反代理中客户IP处理

    * 前言    一般我们部署时会用nginx做为前端处理,有时负载时还会用到其它web服务反代理    这里只给出nginx处理方法,其它参考处理    * nginx上的客户IP传递        ...

随机推荐

  1. 基于pcDuino-V2的无线视频智能小车 - pcduino上的网络编程

    通过获取从串口发送上来的数据  已经和上位机的连接通信和图像发送.已经对设备的控制 https://github.com/qq2216691777/pcduino_smartcar-pcduino

  2. Nuget 命令 NuGet 管理项目库

    因为可视化库程序包管理器的局限性,有很多需要的功能在界面中无法完成. 以下技巧均需要在"程序包管理器控制台"中使用命令来完成. 一.改变项目目标框架后,更新程序包 当改变项目的目标 ...

  3. [LeetCode] Pow(x, n) 求x的n次方

    Implement pow(x, n). 这道题让我们求x的n次方,如果我们只是简单的用个for循环让x乘以自己n次的话,未免也把LeetCode上的想的太简单了,一句话形容图样图森破啊.OJ因超时无 ...

  4. c++多重继承

    可以在子类中通过基类名访问函数 // oj4.cpp : Defines the entry point for the console application.// #include "s ...

  5. JS倒计时执行操作

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  6. hibernate缓存机制(转)

    原文出处:http://www.cnblogs.com/wean/archive/2012/05/16/2502724.html 一.why(为什么要用Hibernate缓存?) Hibernate是 ...

  7. BZOJ 3275: Number

    3275: Number Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 874  Solved: 371[Submit][Status][Discus ...

  8. COGS 2533. [HZOI 2016]小鱼之美

    我们可以发现所有的操作当中,只有坐标的增加,没有坐标的减少. 所以我们可以发现这么一个简单的事实,一条鱼一旦出了渔网,那么它就不可能再回来. 但是目前这并没有什么卵用. 我们可以把询问一个矩阵当中的鱼 ...

  9. codeforces754D Fedor and coupons

    本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000 作者博客:http://www.cnblogs.com/ljh2000-jump/ ...

  10. centeros:生产环境搭建

    p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px "Helvetica Neue"; color: #e4af0a } p. ...