nginx静态文件(css,js等)反向代理

https://www.aifou.net/2019/10/23/nginx-proxy-pass/
静态文件丢失需要单独给设置


location /wxpaydemoh5
{
    proxy_pass http://172.16.90.25:8080;
    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_set_header REMOTE-HOST $remote_addr;
    
    add_header X-Cache $upstream_cache_status;
    
    #Set Nginx Cache
    
    	add_header Cache-Control no-cache;
    expires 12h;
}
location ~ /static/.*\.(js|css|jpg|png|gif|ico)$ { 
     proxy_pass http://172.16.90.25:8080; 
     rewrite ^/wxpaydemoh5/static/(.*)$ /static/$1 last;
}

THE END
分享
二维码
打赏
< <上一篇
下一篇>>