带有子文件夹符号链接的 Tomcat
我有一个网络应用程序,它实际上是一个名为:App-0.0.1-SNAPSHOT 的符号链接,它工作正常。
现在,我想创建文件夹 App-0.0.1-SNAPSHOT 并使用子目录中的符号链接。
我希望 WEB-INF 链接到一个地方。
我希望客户端文件(/js 和 /css)链接到另一个地方。
在这种情况下我得到 404。
这篇文章实际上做了同样的事情,但是由于某种原因,我无法完成它......
再次,链接到 webapp 根文件夹工作正常。
你能提出一个解决方案吗?
谢谢
I have a webapp that is actually a symlink named: App-0.0.1-SNAPSHOT and it is working fine.
Now instead of that, i want to create the folder App-0.0.1-SNAPSHOT and use the symlinks in the subdirectories.
I want the WEB-INF to link to one place.
And i want the Client files (/js and /css) to link to another place.
In this case i am getting 404.
This article is actually doing the same, but for some reasong i cant get it done....
Again, linking to the webapp root folder works fine.
Can you suggest a solution?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我发现使用命令 sudo mount --bind olddir newdir 可以让我摆脱麻烦。如果您没有 root 访问权限,那么这对您不起作用。有关绑定的更多信息,请参阅
mount --help
或man mount
,但它基本上将一个目录安装在另一个目录之上,因此它具有与符号链接相同的效果,但它得到解决 Tomcat 对符号链接的限制。在您的示例中,您可能需要类似
sudo mount --bind /path/to/your/sandbox/js /var/lib/tomcat7/webapps/App-0.0.1-SNAPSHOT/js
然后类似的css
目录。I found that using the command
sudo mount --bind olddir newdir
gets me out of trouble. If you don't have root access then this won't work for you. Seemount --help
orman mount
for some more info on binding but it basically mounts one directory on top of another so it has the same affect as a symlink but it gets around tomcat's limitation with symlinks.In your example, you'd probably want something like
sudo mount --bind /path/to/your/sandbox/js /var/lib/tomcat7/webapps/App-0.0.1-SNAPSHOT/js
and then similar for thecss
directory.出于安全原因,默认情况下 Tomcat 不遵循符号链接。您也许可以配置它来执行此操作 - 请参阅本文。
For security reasons, by default Tomcat does not follow symlinks. You may be able to configure it to do so -- see this article.