解决nginx反向代理缺少css,js文件的问题

直接粘贴到配置文件即可

location ~* \.(js|css|png|jpg|jpeg|gif|ico|eot|otf|ttf|woff|woff2)$ {
            proxy_pass 代理的地址;
            add_header Access-Control-Allow-Origin *;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            expires 1d;
        }
    location = /favicon.ico {
     log_not_found off;
}
location /oa/ {
proxy_pass http://192.168.189.164:1340/;
}
location /static/ {
proxy_pass http://192.168.189.164:1340/static//;
} 

你可能感兴趣的:(nginx,javascript,运维)