./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

最新文章

  1. EasyUI datagrid : 启用行号、固定列及多级表头后,头部行号位置单元格错位的问题
  2. Chapter 1: 随机事件及其概率
  3. 设计模式(2)--单例模式(Singleton Pattern)
  4. ubuntu14.04中文楷体变默认字体
  5. [stl] SGI STL的空间配置器
  6. is_user_logged_in()
  7. Bzoj 2243: [SDOI2011]染色 树链剖分,LCT,动态树
  8. 高效删除 ListItem
  9. css实现超连接按钮形式显示
  10. [Hapi.js] Friendly error pages with extension events
  11. HDU3853-LOOPS(概率DP求期望)
  12. CentOS6.4 编译安装Python 3.3.2 - CRPER木木
  13. What is tradebit?
  14. MVC3+EF4.1学习系列(四)----- ORM关系的处理
  15. 微信小程序 - 上拉加载
  16. JUnit4快速入门
  17. 【视频合集】极客时间 react实战进阶45讲 【更新中】
  18. Nintex Forms Drop-Down &quot;z-index&quot;
  19. web3.js编译Solidity,发布,调用全部流程(手把手教程)
  20. mysql命令(三)

热门文章

  1. android SharedPreferences 存储对象
  2. 关于EventEmitter的用法
  3. 在Unity环境下使用抽象和接口
  4. C#实现Levenshtein distance最小编辑距离算法
  5. Linux的Shell
  6. 聊聊 C 语言中的 sizeof 运算
  7. _web基础_servlet基础
  8. sql server 多列转多行实现方法
  9. Mybatis传入参数类型为Map
  10. ActiveMQ入门