zoukankan      html  css  js  c++  java
  • nginx基于目录的映射:

    nginx基于目录的映射:

       location /wxchat/ {
              #proxy_redirect off;
              proxy_set_header Host $host;
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    
              proxy_cookie_path  /xie_wechat /wechat;
              proxy_set_header   Cookie $http_cookie;
    
              proxy_pass http://10.8.0.9:8080/xie_wechat/;
              #proxy_set_header X-Forwarded-Proto https;
              proxy_redirect http:// $scheme://;
    
              #try_files $uri $uri/ /index.html;
    
                 if ($request_method = 'OPTIONS') {
                    add_header 'Access-Control-Allow-Origin' '*';
                    add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
    
                    add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
    
                    add_header 'Access-Control-Max-Age' 1728000;
                    add_header 'Content-Type' 'text/plain charset=UTF-8';
                    add_header 'Content-Length' 0;
                    return 204;
                 }
                 if ($request_method = 'POST') {
                    add_header 'Access-Control-Allow-Origin' '*';
                    add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
                    add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
                 }
                 if ($request_method = 'GET') {
                    add_header 'Access-Control-Allow-Origin' '*';
                    add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
                    add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
                 }
    
    
    
              if ($request_filename ~* .*.(html|htm)$)
              {
                expires -1s;
              }
              if ($request_filename ~* .*.(gif|jpg|jpeg|png|bmp|swf)$)
              {
                expires -1s;
              }
              if ($request_filename ~ .*.(js|css)$)
              {
                expires -1s;
              }
        }
    

      

  • 相关阅读:
    Linux系统分支之Ubuntu
    运维工具之Netdata
    Antd Tree组件虚拟滚动空白问题
    没有root权限的情况下安装vim
    C++ / Python测量程序执行时间
    Linux dmidecode 命令介绍
    网卡到底是什么
    flannel的革命性的变化是在哪里呢?
    kube-proxy
    cilium
  • 原文地址:https://www.cnblogs.com/jifeng/p/7852211.html
Copyright © 2011-2022 走看看