- 对于manager页面,在已经设置了用户和manager-gui, manager-script权限之后,仍然报403权限问题
Manager 403 Access Denied : You are not authorized to view this page .
By default the Manager is only accessible from a browser running on the same machine as Tomcat . If you wish to modify this restriction , you ’ll need to edit the Manager ’s context . xml file .
或manager/text接口:
Tomcat return http status error : 403 , Reason Phrase :(中间省略一堆html代码) The server understood the request but refuses to authorize it
这个时候只需要按照上面的提示,修改manager的context.xml文件即可,具体在manager/META-INF/context.xml,修改如下,将Value标签整个注释掉即可,无需重启tomcat(可能需要稍等几秒钟):
<
Context
antiResourceLocking
="false"
privileged
="true" >
<!--
<Valve className="
org
.
apache
.
catalina
.
valves
.
RemoteAddrValve
"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
-->
</
Context
>
这里的allow是指定了允许访问的ip地址,allow的值是正则表达式,明显默认值表示只能由本地访问,所以我使用nginx代理的时候访问是没有问题的。
因此这里只需将allow的值修改为符合条件的正则表达式,例如最简单的 allow="^.*$"
。当然,除非有特别的需要,最方便的做法还是直接注释了。
- eclipse中tomcat部署目录的设置
eclipse 默认tomcat部署在:
workspace . metadata .plugins\org. eclipse . wst . server .core\tmp0\webapps
嗯,乱七八糟的目录。我上传图片后,再重新访问图片就给了我一个404。
使用servletContext.getRealPath("/");
获取到的目录完全不是自己想要的。这个时候就想到了修改部署目录。
但是,tomcat中有部署项目的时候是无法重新修改部署路径的,这个时候就需要在server窗口, 右键tomcat, 选择 Add and Remove…, remove掉右边窗口所有的项目,然后再右击tomcat,选择open,在 Server Location 下就可以修改部署目录 deploy path 了