nginx - 反向代理 - 配置文件 header - 日志log格式
server {
listen ;
server_name paas.service.consul;
client_max_body_size 512m;
access_log /data/bkdata/bkce/logs/nginx/paas_inner_access.log;
# ============================ paas ============================
# PAAS_SERVICE HOST/PORT
location ~ ^/login/(.*) {
proxy_pass http://OPEN_PAAS_LOGIN/$1$is_args$args;
proxy_pass_header Server;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $http_host;
proxy_redirect off;
proxy_read_timeout ;
}
#user root;
worker_processes auto; error_log /usr/local/var/log/nginx/error.log;
#pid logs/nginx.pid; events {
worker_connections ;
} http {
include mime.types;
default_type application/octet-stream;
#default_type text/html; client_max_body_size 2G;
server_names_hash_bucket_size ; sendfile on; keepalive_timeout ; log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'"$gzip_ratio" $request_time $bytes_sent $request_length';
underscores_in_headers on;
include /usr/local/etc/nginx/conf.d/*.conf;
}
2.长连接需要配置

proxy_http_version 1.1;
proxy_set_header Connection ""; #如果没加,后端服务器会收到 Connection: close 的 Header,而不能复用连接; 清空connection的请求头,避免客户端传递短链接的请求头信息。
https://www.jianshu.com/p/fd16b3d10752
nginx - 反向代理 - 配置文件 header - 日志log格式的更多相关文章
- nginx.conf nginx反向代理配置文件
nginx反向代理配置文件 nginx.conf proxy_default.conf proxy.conf vhost/*.conf upstream/*.conf cache/*.conf ngi ...
- nginx --反向代理配置文件
配置文件如下图 server { listen 8080; server_name 0.0.0.0;//这里可以配置相应域名 root /www/facei; index index.html i ...
- Nginx反向代理时tomcat日志获取真实IP
对于nginx+tomcat这种架构,如果后端tomcat配置保持默认,那么tomcat的访问日志里,记录的就是前端nginx的IP地址,而不是真实的访问IP.因此,需要对nginx.tomcat做如 ...
- Nginx反向代理配置文件
server { listen ; server_name ; root E:/Upays/public/; index index.php index.html; log_not_found off ...
- Nginx反向代理设置header
特别提示:本人博客部分有参考网络其他博客,但均是本人亲手编写过并验证通过.如发现博客有错误,请及时提出以免误导其他人,谢谢!欢迎转载,但记得标明文章出处:http://www.cnblogs.com/ ...
- nginx - 反向代理 - 配置文件模板 - nginx 代理tcp的服务 - 部署示意图
danjan01deiMac:~ danjan01$ cat /usr/local/etc/nginx/nginx.conf|grep -v '^$' worker_processes 1; even ...
- 十.nginx反向代理负载均衡服务实践部署
期中集群架构-第十章-nginx反向代理负载均衡章节章节====================================================================== 0 ...
- Nginx反向代理配置可跨域
由于业务需要,同一项目中的前端代码放在静态环境中,而后端代码放在tomcat中,但此时问题却出现了:前端使用ajax请求后端获取数据时出现如下报错 XMLHttpRequest cannot load ...
- linux篇—Nginx反向代理负载均衡
一.环境准备 反向代理功能架构 3台web服务器,组建出web服务器集群 web01 10.0.0.7 172.16.1.7 web02 10.0.0.8 172.16.1.8 web03 10.0. ...
随机推荐
- jpa单向一对多
单向一对多是一个类中的一条记录可对应另一个类的多条记录: 比如一个部门可对应多个员工: jpa中的实现步骤: one-to-many的one类中添加一个many类类型的set;比如部门类D ...
- Python三引号(triple quotes)
python中三引号可以将复杂的字符串进行复制: python三引号允许一个字符串跨多行,字符串中可以包含换行符.制表符以及其他特殊字符. 三引号的语法是一对连续的单引号或者双引号(通常都是成对的用) ...
- [Docker]docker搭建私有仓库(ssl、身份认证)
docker搭建私有仓库(ssl.身份认证) 环境:CentOS 7.Docker 1.13.1 CentOS 7相关: https://www.cnblogs.com/ttkl/p/11041124 ...
- .net上传超大文件解决方案
HTML部分 <%@PageLanguage="C#"AutoEventWireup="true"CodeBehind="index.aspx. ...
- python 多线程实现循环打印 abc
python 多线程实现循环打印 abc 好久没写过python了, 想自己实践一下把 非阻塞版 import threading import time def print_a(): global ...
- Spring——代理工厂实现增强
借助Spring IOC的机制,为ProxyFactory代理工厂的属性实现依赖注入,这样做的优点是可配置型高,易用性好. 1.创建抽象主题 public interface ProService { ...
- 通过nginx转发,用外网连接阿里云的redis,报Unexpected end of stream的解决办法
一.在与redis同一个内网的服务器上A的nginx做了下面的设置 stream { upstream redis { server redis.rds.aliyuncs.com:6379 max_ ...
- spark feature
spark推测执行:当成功的Task数超过总Task数的75%(可通过参数spark.speculation.quantile设置)时,再统计所有成功的Tasks的运行时间,得到一个中位数,用这个中位 ...
- HNOI2012排队
排列组合题(本文A(n,m)表示从n个元素里选m个的排列数). 首先,老师和女生有不能相邻的限制条件,应该用插空法.而且老师人数较少且固定,把老师和男生进行混合,对女生用插空. 我先来一手错误做法,n ...
- Eclipse改变成炫酷黑色主题
有一个款Eclipse插件EclipseColorTheme,其官网地址是http://eclipsecolorthemes.org/,可以直接使用大量内置的样式主题模板,如果还不能满足你自己的个性化 ...