nginx_ssl证书双向认证以及负载均衡配置
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
use epoll;#仅用于linux2.6以上内核,可以大大提高nginx的性能
worker_connections 1024;
}
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;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#开启gzip压缩
gzip on;
#设定请求缓冲
client_header_buffer_size 128k;
large_client_header_buffers 4 128k;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#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;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
#http向https的强制跳转
server {
listen 80;
server_name ca.server.com;
rewrite ^(.*)$ https://$host$1 permanent;
}
#负载均衡
upstream https_proxy {
server 192.168.40.1:8090 max_fails=0;
server 192.168.40.1:8080 max_fails=0;
#server 192.168.40.128:8080 max_fails=0;
}
server {
listen 443 ssl;
server_name ca.server.com;
ssl on;
ssl_certificate /usr/local/nginx/ssl/ca.server.com.crt;#服务端证书
ssl_certificate_key /usr/local/nginx/ssl/ca.server.com.key;#服务端秘钥
ssl_client_certificate /usr/local/nginx/ssl/ca.server.com.chain.crt;#证书链
ssl_session_timeout 5m;
ssl_verify_depth 2;
ssl_verify_client on; #开户客户端证书验证
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
charset utf-8;
#定义服务器的默认网站根目录位置
root html;
# 定义错误提示页面
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
location / {
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header Client-Cert $ssl_client_cert; # 将客户端证书放到http头中传递给后端的tomcat
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_set_header X-Forwarded-Proto $scheme;#对应tomcat的server.xml的设置
add_header Power-By-Tyumen "$upstream_cache_status from $hostname";
proxy_pass http://https_proxy;
proxy_buffer_size 4k;
proxy_buffers 256 4k;
proxy_max_temp_file_size 0;
proxy_connect_timeout 30;
proxy_send_timeout 15;
proxy_read_timeout 600;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
location = /favicon.ico { ## 采用完全匹配模式
log_not_found off; ## 不写 error.log
access_log off; ## 不写 access.log
}
#access_log /data/logs/https_proxy.log custom_log;
}
}
nginx_ssl证书双向认证以及负载均衡配置的更多相关文章
- Nginx + Tomcat Windows下的负载均衡配置
Nginx + Tomcat Windows下的负载均衡配置 一.为什么需要对Tomcat服务器做负载均衡? Tomcat服务器作为一个Web服务器,其并发数在300-500之间,如果超过50 ...
- nginx安装及负载均衡配置
Nginx (“engine x”) 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器. Nginx 是由 Igor Sysoev 为俄罗斯访问量第二 ...
- Nginx负载均衡配置实例详解
负载均衡是我们大流量网站要做的一个东西,下面我来给大家介绍在Nginx服务器上进行负载均衡配置方法,希望对有需要的同学有所帮助哦. 负载均衡 先来简单了解一下什么是负载均衡,单从字面上的意思来理解就可 ...
- Nginx 简单的负载均衡配置示例(转载)
原文地址:Nginx 简单的负载均衡配置示例(转载) 作者:水中游于 www.s135.com 和 blog.s135.com 域名均指向 Nginx 所在的服务器IP. 用户访问http://www ...
- Nginx负载均衡配置实例详解(转)
负载均衡是我们大流量网站要做的一个东西,下面我来给大家介绍在Nginx服务器上进行负载均衡配置方法,希望对有需要的同学有所帮助哦. 负载均衡 先来简单了解一下什么是负载均衡,单从字面上的意思来理解就可 ...
- Nginx做NodeJS应用负载均衡配置实例
这篇文章主要介绍了Nginx做NodeJS应用负载均衡配置实例,本文直接给出配置实例,需要的朋友可以参考下. 负载均衡可以把用户的请求分摊到多个服务器上进行处理,从而实现了对海量用户的访问支持.负载均 ...
- Nginx+tomcat负载均衡配置
Nginx+tomcat是目前主流的java web架构,如何让nginx+tomcat同时工作呢,也可以说如何使用nginx来反向代理tomcat后端均衡呢?直接安装配置如下: 1.JAVA JDK ...
- CentOS6.5安装nginx及负载均衡配置
所有的安装包可以去以下地址下载,或者自行去官网下载,下面都有介绍. 所有安装包地址:http://download.csdn.net/detail/carboncomputer/9238037 原文地 ...
- Flume负载均衡配置
flume负载均衡配置 集群DNS配置如下: hadoop-maser 192.168.177.162 machine-0192.168.177.158 machine-1191.168.177.16 ...
随机推荐
- Impala Apache Hadoop 安装方法
http://blog.csdn.net/mayp1/article/details/50952512
- Asp.Net 自定义设置Http缓存示例(一)
一.自定义图片输出,启用客户端的图片缓存处理 代码示例: string path = Request.Url.LocalPath; if (path != null) { path = path.To ...
- 关于cxf生成客户端代码中的JAXBElement<String>
1.使用自动生成的java文件中的 ObjectFactory构造入参 关于cxf生成客户端代码中的JAXBElement<String> 在使用cxf或者x-fire进行webse ...
- jvm理论-常量池-string
字符串常量池-常量项(cp_info)结构 CONSTANT_String_info{ u1 tag=8; u2 string_index;//存放 CONSTANT_Utf8_info 指针 } C ...
- ionic 状态栏显示异常 statusBar
从主分支上新建一个分支开发另一个app, 生成之后手机上显示状态栏异常, 如下图, 只显示了电池的色块, 百思不得其解啊. 各种猜测无果, 对比config.xml, 发现statusBar插件版本不 ...
- PL/SQL学习笔记之事务
一:事务自动提交的开启与关闭 1)开启事务自动提交:则每一个INSERT,UPDATE或DELETE命令执行时,都提交一次事务. SET AUTOCOMMIT ON; 2)关闭事务自动提交:则执行到C ...
- Google protobuf解析消息逻辑的版本问题
在分析caffe2源码的过程中,由于caffe2使用protobuf作为网络结构和网络参数序列化和反序列化的机制,想在反序列化之前进行加解密处理,这是反向protouf其实有两个版本的实现来进行消息的 ...
- Unity3D中录制和输出wav文件
近期在做视频录制方面的事情,看了下音频的录制和输出.主要参考官方的FrameCapturer: https://github.com/unity3d-jp/FrameCapturer wav文件结构较 ...
- Oracle分析函数-nulls first/nulls last
select * from criss_sales; 通过rank().dense_rank().row_number()对记录进行全排列.分组排列取值但有时候,会遇到空值的情况,空值会影响得到的结果 ...
- 接口和多态都为JAVA技术的核心。
类必须实现接口中的方法,否则其为一抽象类. 实现中接口和类相同. 接口中可不写public,但在子类中实现接口的过程中public不可省. (如果剩去public则在编译的时候提示出错:对象无法从 ...