nginx 静态资源转发
NGINX 代理转发,NGINX 静态资源转发
通过nginx代理静态资源(js/css 等)
spring boot 创建web应用时请求URL无法访问样式问题?
nginx 转发代理 Spring-boot 提示 Whitelabel Error Page 处理方式
Css样式引入和静态资源存放在assets,后端上传的资源存放在public
nginx 代理转发示例:
server { listen 80; server_name css.test.cn; charset utf-8; client_max_body_size 35m;
# nginx 代理转发后端服务 location / { proxy_pass http://172.16.2.18:8001/; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }
# 静态资源转发配置
location ~ .*\.(js|css|jpg|jpeg|gif|png|ico|pdf|txt)$ { proxy_pass http://172.16.2.18:8001; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Accept-Encoding ""; sub_filter_types *; sub_filter_once off; sub_filter 'indexTips' 'indexTips1'; } }
重启 Nginx 进程