---- AI试用 ---域名问题某些图片和js资源无法访问,导致一些代码实例无法运行!(代码里gzui.net换成momen.vip即可)

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

前端开发 蚂蚁 1460℃ 0评论

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;
}

转载请注明:有爱前端 » nginx静态文件(css,js等)反向代理

喜欢 (2)or分享 (0)

(1)个小伙伴在吐槽