nginx和tomcat搭配使用,让nginx可以访问tomcat下面的静态资源
来源:互联网 发布:360浏览器淘宝比价 编辑:程序博客网 时间:2024/04/30 05:35
我们现在开发的一个网站,用的还是比较老的技术,使用jsp开发的,部署在tomcat下面,然后使用nginx做反向代理,配置的时候遇到一个问题,就是浏览器访问的时候只有一些页面元素,一些css、js、图片这些静态资源都没有加载出来,后来找了很多资料,做出如下配置:
server {
listen 443;
server_name doc.wlyl.com;
location /yiliao_doc/ {
proxy_pass http://192.168.9.12:8081;
proxy_redirect off ;
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 X-Forwarded-Proto $scheme;
proxy_next_upstream error timeout invalid_header;
}
location ~ .*\.(html|htm|ico|png|jpg|jpeg|js|css|bmp)$ {
proxy_pass http://192.168.9.12:8081;
}
}
注意:location通过正则表达式来配置可以访问静态资源,通过正则表达式配置location,里面的proxy_pass一定不能有uri,
即配置成:proxy_pass http://192.168.9.12:8081/;
或者
proxy_pass http://192.168.9.12:8081/yiliao_doc;
都是错的~
- nginx和tomcat搭配使用,让nginx可以访问tomcat下面的静态资源
- nginx + tomcat 配置,静态资源直接使用nginx
- 使用nginx如何让一个tomcat下的多个应用可以被多个域名绑定
- nginx负载均衡两个tomcat,nginx处理静态资源
- Nginx 静态资源访问
- nginx动态访问静态资源,图片服务器配置2中方式,tomcat访问图片
- 在自己笔记本电脑上如何访问虚拟机的内容、包括可以使用ssh、访问tomcat、访问nginx
- 遇到问题--Nginx---tomcat启动web程序访问静态资源时404找不到
- Nginx和Tomcat配合使用
- 使用nginx后让tomcat的localhost_access_log获得真实IP
- 使用Nginx+Tomcat访问本地目录
- CentOS 配置Tomcat及搭配Nginx
- tomcat结合nginx的使用
- Nginx+Tomcat的配合使用
- Nginx和Tomcat的集群
- Nginx和tomcat的配置
- tomcat和nginx的区别
- nginx和tomcat的区别
- hadoop学习笔记(一)
- A potentially dangerous Request.Form value was detected from the client (FCKeditor="<img alt="" src=
- kalman滤波的本质
- 超长正整数相加(OJ)
- vue.js 快速理解
- nginx和tomcat搭配使用,让nginx可以访问tomcat下面的静态资源
- hadoop从零开始--linux下jdk,tomcat,mysql的安装
- Glide Android图片加载的利器---基本介绍和使用
- 范围搜索 (Range Query)
- Unity 移动端触摸屏操作
- 使用maven创建web项目
- HTTP相关,Android使用Fidder抓包
- jsp和html的区别以及jsp是如何实现动态的
- 如何调试服务