• nginx 反向代理转发导致css,js,图片失效


     需要添加以下配置

           
           location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ {
                 proxy_pass https://localhost:7443;
             }
            location ~ .*.(js|css)$ {
                 proxy_pass https://localhost:7443;
             }
    

    完整的配置

       
    
      listen     443 ssl;
            server_name  localhost;
            ssl on;
            ssl_certificate        /app/weixin/certificate/server.crt;
            ssl_certificate_key    /app/weixin/certificate/server.key;
            ssl_session_timeout  5m;
            ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
            ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
            ssl_prefer_server_ciphers on;
    
           
            location ^~ /mp/ {
                 proxy_pass https://localhost:6443/;
                 proxy_set_header Host      $host;
                 proxy_set_header X-Real-IP $remote_addr;
                 proxy_redirect http:// $scheme://;
                 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            }
            location ^~ /dubbo/ {
                 proxy_pass https://localhost:7443/;
                 proxy_set_header Host      $host;
                 proxy_set_header X-Real-IP $remote_addr;
                 proxy_redirect http:// $scheme://;
                 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            }
    
            location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ {
                 proxy_pass https://localhost:7443;
             }
            location ~ .*.(js|css)$ {
                 proxy_pass https://localhost:7443;
             }
    
    

    参考网站:
    http://www.360doc.com/content/14/0616/12/203871_387137334.shtml
    https://blog.csdn.net/kepoon/article/details/73253059

    转载于:https://my.oschina.net/jywm/blog/1790197

  • 相关阅读:
    CCF_2014_09_2_画图
    计蒜课_等和分隔子集
    计蒜客_合法分数的组合
    读构建之法的读书笔记
    四则运算及感想
    psp 第二周
    第二周 词频统计
    历年作品点评
    四人小组项目
    品读《构建之法》及几个问题的提出
  • 原文地址:https://www.cnblogs.com/twodog/p/12137172.html
Copyright © 2020-2023  润新知