1. server {
  2. listen ;
  3. server_name paas.service.consul;
  4.  
  5. client_max_body_size 512m;
  6. access_log /data/bkdata/bkce/logs/nginx/paas_inner_access.log;
  7.  
  8. # ============================ paas ============================
  9. # PAAS_SERVICE HOST/PORT
  10.  
  11. location ~ ^/login/(.*) {
  12. proxy_pass http://OPEN_PAAS_LOGIN/$1$is_args$args;
  13. proxy_pass_header Server;
  14. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  15. proxy_set_header X-Real-IP $remote_addr;
  16. proxy_set_header X-Scheme $scheme;
  17. proxy_set_header Host $http_host;
  18. proxy_set_header X-Forwarded-Proto $scheme;
  19. proxy_set_header X-Forwarded-Host $http_host;
  20. proxy_redirect off;
  21. proxy_read_timeout ;
  22. }
  1. #user root;
  2. worker_processes auto;
  3.  
  4. error_log /usr/local/var/log/nginx/error.log;
  5. #pid logs/nginx.pid;
  6.  
  7. events {
  8. worker_connections ;
  9. }
  10.  
  11. http {
  12. include mime.types;
  13. default_type application/octet-stream;
  14. #default_type text/html;
  15.  
  16. client_max_body_size 2G;
  17. server_names_hash_bucket_size ;
  18.  
  19. sendfile on;
  20.  
  21. keepalive_timeout ;
  22.  
  23. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  24. '"$status" $body_bytes_sent "$http_referer" '
  25. '"$http_user_agent" "$http_x_forwarded_for" '
  26. '"$gzip_ratio" $request_time $bytes_sent $request_length';
  27. underscores_in_headers on;
  28. include /usr/local/etc/nginx/conf.d/*.conf;
  29. }

2.长连接需要配置

proxy_http_version 1.1;

proxy_set_header Connection "";  #如果没加,后端服务器会收到 Connection: close 的 Header,而不能复用连接; 清空connection的请求头,避免客户端传递短链接的请求头信息。

https://www.jianshu.com/p/fd16b3d10752

nginx - 反向代理 - 配置文件 header - 日志log格式的更多相关文章

  1. nginx.conf nginx反向代理配置文件

    nginx反向代理配置文件 nginx.conf proxy_default.conf proxy.conf vhost/*.conf upstream/*.conf cache/*.conf ngi ...

  2. nginx --反向代理配置文件

    配置文件如下图   server { listen 8080; server_name 0.0.0.0;//这里可以配置相应域名 root /www/facei; index index.html i ...

  3. Nginx反向代理时tomcat日志获取真实IP

    对于nginx+tomcat这种架构,如果后端tomcat配置保持默认,那么tomcat的访问日志里,记录的就是前端nginx的IP地址,而不是真实的访问IP.因此,需要对nginx.tomcat做如 ...

  4. Nginx反向代理配置文件

    server { listen ; server_name ; root E:/Upays/public/; index index.php index.html; log_not_found off ...

  5. Nginx反向代理设置header

    特别提示:本人博客部分有参考网络其他博客,但均是本人亲手编写过并验证通过.如发现博客有错误,请及时提出以免误导其他人,谢谢!欢迎转载,但记得标明文章出处:http://www.cnblogs.com/ ...

  6. nginx - 反向代理 - 配置文件模板 - nginx 代理tcp的服务 - 部署示意图

    danjan01deiMac:~ danjan01$ cat /usr/local/etc/nginx/nginx.conf|grep -v '^$' worker_processes 1; even ...

  7. 十.nginx反向代理负载均衡服务实践部署

    期中集群架构-第十章-nginx反向代理负载均衡章节章节====================================================================== 0 ...

  8. Nginx反向代理配置可跨域

    由于业务需要,同一项目中的前端代码放在静态环境中,而后端代码放在tomcat中,但此时问题却出现了:前端使用ajax请求后端获取数据时出现如下报错 XMLHttpRequest cannot load ...

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

随机推荐

  1. [人物存档]【AI少女】【捏脸数据】甜美粉色

    点击下载(城通网盘):AISChaF_20191028024804811.png

  2. node的http与前端交互示例(入门)

    一.目录(node_modules是npm install后新增的) node 和 npm 版本 npm install http 二.node下的index.js var http = requir ...

  3. [Python自学] day-16 (JS、作用域、DOM、事件)

    一.JS中的三种函数 1.普通函数 function func(){ console.log("Hello World"); } func() 2.匿名函数 setInterval ...

  4. Jmeter工具使用-分布式架构和服务器性能监控解决方案

    在对项目做大并发性能测试时,常会碰到并发数比较大(比如需要支持10000并发),单台电脑的配置(CPU和内存)可能无法支持,这时可以使用Jmeter提供的分布式测试的功能来搭建分布式并发环境. 一.J ...

  5. PSFTP使用简单教程

    psftp是putty工具下的一个sftp工具.SFTP(Secure File Transfer Protocol)安全文件传输协议,SFTP是SSH的一部分,是一种传输档案至 Blogger 伺服 ...

  6. HDU - 3586 Information Disturbing 树形dp二分答案

    HDU - 3586 Information Disturbing 题目大意:从敌人司令部(1号节点)到前线(叶子节点)的通信路径是一个树形结构,切断每条边的联系都需要花费w权值,现在需要你切断前线和 ...

  7. 本地Git连接远程Gitlab

    本地端安装https://www.cnblogs.com/wei9593/p/11698204.html 1.打开本地git bash,使用如下命令生成ssh公钥和私钥 ssh-keygen -t r ...

  8. Android学习_Fragment

    Fragment 使用Fragment 我们可以把屏幕划分成几块,然后进行分组,进行一个模块化的管理.从而可以更加方便的在运行过程中动态地更新Activity的用户界面.另外Fragment并不能单独 ...

  9. python如何实现一个类似重载的功能

    def post(): print("this is post") print("想不到吧") class Http(): @classmethod def g ...

  10. ccf 201612-3 权限查询

     ccf 201612-3 权限查询 解题思路: 建立一个二维矩阵存储权限和角色 还差30分emmm #include<iostream> #include<cstring> ...