LVS+KeepaLived+Nginx SSL

制作证书 具体可以参考:

http://www.21andy.com/blog/20100224/1714.html

 

Nginx SSL配置:

 

 
  
  1. server  { 
  2.      listen  80; 
  3.      server_name ssl.a.com ; 
  4.      rewrite (.*) https://ssl.a.com   permanent; 
  5.  }     
  6. server { 
  7.      
  8.      listen 443; 
  9.      server_name ssl.a.com;  
  10.      root /data/ssl; 
  11.      index index.html; 
  12.      ssl on; 
  13.      ssl_certificate     /opt/nginx/conf/server.crt; 
  14.      ssl_certificate_key /opt/nginx/conf/server.key; 
  15.  
  16.      location ~ .*\.(php|php5)?$ { 
  17.      #fastcgi_pass  unix:/tmp/php-cgi.sock; 
  18.      fastcgi_pass  127.0.0.1:9000; 
  19.      fastcgi_index index.php; 
  20.      include       fastcgi.conf;  
  21.     } 
  22.      
  23.      location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { 
  24.         expires      30d; 
  25.     } 
  26.  
  27.      location ~ .*\.(js|css)?$ { 
  28.         expires      1h; 
  29.     } 

rewrite规则可以参考:

http://blog.cafeneko.info/2010/10/nginx_rewrite_note/

现在将域名解析到LVS的地址上面,无论是通过http还是https协议访问ssl.a.com 都将以https协议进行访问