系统环境采用centOS7

由于cas server不支持session持久化方式的共享,所以请用其他方式代替,例如:组播复制。

为什么不支持session持久化:http://blog.csdn.net/eguid_1/article/details/51444009

SSL配置详细请查看http://blog.csdn.net/eguid_1/article/details/51282838

nginx反向代理完整配置(两个网站实例)

user nobody nobody;
worker_processes  2;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
error_log /usr/local/nginx/logs/nginx_error.log crit;
pid       /usr/local/nginx/logs/nginx.pid;
worker_rlimit_nofile 20480;
events {
    use epoll;
    worker_connections  2048;
    #multi_accept on;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                        '$status $body_bytes_sent "$http_referer" '
                        '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  logs/access.log  main;
    charset  utf-8;

    server_tokens off;

    server_names_hash_bucket_size 128;
    client_header_buffer_size 32k;
    large_client_header_buffers 4 64k;

    sendfile on;
    keepalive_timeout 60;

    tcp_nopush on;
    tcp_nodelay on;

    fastcgi_cache_path /usr/local/nginx/fastcgi_cache levels=1:2
                        keys_zone=TEST:10m
                        inactive=5m;
    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
    fastcgi_buffer_size 64k;
    fastcgi_buffers 4 64k;
    fastcgi_busy_buffers_size 128k;
    fastcgi_temp_file_write_size 128k;

    gzip  on;
    gzip_min_length 1000;
    gzip_buffers 4 16k;
    gzip_http_version 1.0;
    gzip_comp_level 3;
    #gzip_types text/plain application/x-javascript text/css application/xml;
    gzip_types  text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_vary on;

    #limit_zone crawler $binary_remote_addr 10m;
    client_max_body_size 8m;
    client_body_buffer_size 128k;

    proxy_connect_timeout 600;
    proxy_read_timeout 600;
    proxy_send_timeout 600;
    proxy_buffer_size  16k;
    proxy_buffers  4 32k;
    proxy_busy_buffers_size 64k;
    proxy_temp_file_write_size 64k;

#server1
    upstream eguid
    {
      server 192.168.30.19:8080 weight=5;
    # server 192.168.30.14:8080 weight=5;
    # server 192.168.30.15:8080 weight=5;
    # server 192.168.30.16:8080 backup;
    }
#cas-server
    upstream account{

       server 192.168.30.16:8080;
       #jvm_route $cookie_JSESSIONID|sessionid reverse;
    }
    server {
        listen  80;
        server_name eguid.cn;
        #index index.html index.htm index.jsp index.php;
        #root /data/www/eguid;
        #charset koi8-r;

        access_log  logs/host.access.log  main;

        location / {
         proxy_pass http://eguid;
         #proxy_pass http://account;
         #proxy_set_header X-Forwarded-Proto https;
         #proxy_set_header        Host lingdong;
         #proxy_set_header        X-Real-IP $remote_addr;
         #proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }
    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

   # cas-server

    server {
       listen       80;
       server_name  passport.eme.com;
       #ssl on;
       #ssl_certificate  /usr/local/nginx/conf/keys/passport.pem;
       #ssl_certificate_key  /usr/local/nginx/conf/keys/passport.key;
       #ssl                  on;
       #ssl_certificate       /usr/local/nginx/conf/passport.crt;
       #ssl_certificate_key  /usr/local/nginx/conf/passport_nopass.key;
       #ssl_session_timeout  5m;
       #ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
       #ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
       #ssl_prefer_server_ciphers on;
       location / {
           #proxy_redirect https://passport.eme.com/;
           #proxy_cookie_domain passport.eme.com;
           #proxy_redirect off;
           proxy_pass http://account;
           proxy_cookie_path /cas-server/ /;
           proxy_cookie_path /cas-server /;
           proxy_set_header   Cookie $http_cookie;
           proxy_set_header   Host $host;
           proxy_set_header   Remote_Addr $remote_addr;
           proxy_set_header   X-Real-IP $remote_addr;
           proxy_set_header   REMOTE-HOST $remote_addr;
           proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
         }
      }

#https server

    server {
       listen     443;
       server_name  passport.eme.com;
       ssl_certificate  /usr/local/nginx/conf/keys/eme.com.crt;
       ssl_certificate_key  /usr/local/nginx/conf/keys/eme.com.key;
       ssl_session_timeout  5m;
ssl on;
 ssl_protocols  SSLv2 SSLv3 TLSv1;
 ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
 ssl_prefer_server_ciphers   on;
       location / {
                     root   html;
                     index  index.html index.htm;
                  }
      }

}

nginx反向代理cas server之1:多个cas server负载均衡配置以及ssl配置的更多相关文章

  1. Nginx反向代理讲解和配置

    首先来介绍下Nginx的反向代理.代理服务器一般分为正向代理(通常直接称为代理服务器)和反向代理. 画个图我们就好理解了. 正向代理:可以想象成是路由器,我们要通过它来上网的那种.(可以说是客户端的代 ...

  2. [nginx]Windows和Mac下,nginx反向代理服务器配置

    最近做项目,前端需要用到nginx反向代理来转发请求,总结了一下在Windows和Mac上的配置,以备查询. 一.Windows 修改nginx的配置文件,nginx.conf. 1)nginx.co ...

  3. Nginx 反向代理时获取用户的真实 IP

    在平时我们开发后端程序的过程中,应该多多少少都会碰到记录客户端 IP 的场景,例如我之前写过的 APP 用户的一个审计功能,就需要获取用户的 IP 地址:还有广告系统里面,也是需要获取用户的 IP 地 ...

  4. Server 主机屋云服务器 宝塔面板 部署nginx反向代理的vue项目

    图文记录云服务器上部署需要nginx反向代理的vue项目: 一.先登录并购买云服务器,根据自己需求购买,此处不详细介绍: 二.登录后如下图,点击进入云服务器界面: 三.在云服务器界面点击管理,进入管理 ...

  5. 使用python自动生成docker nginx反向代理配置

    由于在测试环境上用docker部署了多个应用,而且他们的端口有的相同,有的又不相同,数量也比较多,在使用jenkins发版本的时候,不好配置,于是想要写一个脚本,能在docker 容器创建.停止的时候 ...

  6. Nginx反向代理,负载均衡,redis session共享,keepalived高可用

    相关知识自行搜索,直接上干货... 使用的资源: nginx主服务器一台,nginx备服务器一台,使用keepalived进行宕机切换. tomcat服务器两台,由nginx进行反向代理和负载均衡,此 ...

  7. Nginx反向代理部署指南

    一.反向代理 我们都知道,80端口是web服务的默认端口,其他主机访问web服务器也是默认和80端口进行web交互,而一台服务器也只有一个80端口,这是约定俗成的标准. 我们来看下面两个场景: 1.服 ...

  8. Nginx 反向代理、负载均衡、页面缓存、URL重写及读写分离详解

    转载:http://freeloda.blog.51cto.com/2033581/1288553 大纲 一.前言 二.环境准备 三.安装与配置Nginx 四.Nginx之反向代理 五.Nginx之负 ...

  9. Nginx反向代理和负载均衡

    一.Nginx反向代理设置 从80端口转向其他端口反向代理(Reverse Proxy)方式是指以代理服务器来接受internet上的连接请求,然后将请求转发给内部网络上的服务器,并将从服务器上得到的 ...

随机推荐

  1. 一文读懂 HTTP/2 特性

    HTTP/2 是 HTTP 协议自 1999 年 HTTP 1.1 发布后的首个更新,主要基于 SPDY 协议.由互联网工程任务组(IETF)的 Hypertext Transfer Protocol ...

  2. ZJOI2017 day1滚粗记

    这几天去温州作为外省选手参加了$ZJOI day1$.打了几天的酱油,考试也滚粗了.. $day -2$ 中午从学校出发,坐飞机去温州.到了温州以后吃完晚饭就回宾馆.把一直想做的糖果公园做完了以后就堕 ...

  3. bzoj4818 [Sdoi2017]序列计数

    Description Alice想要得到一个长度为n的序列,序列中的数都是不超过m的正整数,而且这n个数的和是p的倍数.Alice还希望,这n个数中,至少有一个数是质数.Alice想知道,有多少个序 ...

  4. FrameBuffer系列 之 介绍

    1.     来由 FrameBuffer是出现在2.2.xx内核当中的一种驱动程序接口.Linux工作在保护模式下,所以用户态进程是无法象 DOS 那样使用显卡 BIOS里提供的中断调用来实现直接写 ...

  5. 为什么要用Handler ?

    我的理解,Handler的好处之一就是配合子线程处理数据之后控制UI的显示. 如下是http://www.cnblogs.com/sydeveloper/p/3312865.html的完美解释: 当应 ...

  6. Java设计模式随笔

    大家都知道Java23种设计模式,大神总结如下: 创建型模式,共五种:工厂方法模式.抽象工厂模式.单例模式.建造者模式.原型模式. 结构型模式,共七种:适配器模式.装饰器模式.代理模式.外观模式.桥接 ...

  7. 手把手教你学SVN

    注意 转载须保留原文链接(http://www.cnblogs.com/wzhiq896/p/6822713.html  ) 作者:wangwen896 整理 对于很多新手来说,SVN 代码托管一无所 ...

  8. 产品经理学Python:for循环、while循环

    Python中有两种循环,分别为:for循环和while循环. 1. for循环 for循环可以用来遍历某一对象(遍历:通俗点说,就是把这个循环中的第一个元素到最后一个元素依次访问一次).for循环的 ...

  9. 玩一玩nodejs--一个简单的在线实时填表应用

    学习nodejs三天,入了个门,感觉他和jsp.php还是存在较大的差别.本文首先复习这些天学的一些知识点,然后谈一下如何一步一步到做一个在线实时填表的小应用,进一步巩固一下这些个知识点.这里先简单介 ...

  10. hdu1420 Prepared for New Acmer 简单数学

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1420 简单数学题 第一次wa在可能和会出现取模后值为负数的情况. 只要会一个数论上的简单公式(a*b) ...