gpt4 book ai didi

spring - 带有 Proxypass 和 Spring Security 的 Apache

转载 作者:行者123 更新时间:2023-11-28 22:29:08 26 4
gpt4 key购买 nike

我有一个使用 Spring Security 进行登录的 Spring MVC 应用程序。我使用 Apache Webserver 作为代理和 Tomcat。下面是我的/etc/apache2/sites-enabled/example.com.conf 文件:

ServerAdmin admin@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public_html

ProxyPreserveHost On
ProxyRequests off

ProxyPass /myapp/j_spring_security_check http://localhost:8080/myapp/j_spring_security_check
ProxyPassReverse /myapp/j_spring_security_check http://localhost:8080/myapp/j_spring_security_check
ProxyPass /myapp http://localhost:8080/myapp
ProxyPassReverse /myapp http://localhost:8080/myapp

这工作正常,我可以登录到我的站点。但是,我必须使用 http://example.com/myapp而不是 http://example.com .如果我稍后使用,它会显示:

Index of /

[ICO] Name Last modified Size Description
[IMG] favicon.ico 2015-02-23 14:15 7.6K

如果我按照其他站点/帖子的建议修改 example.com.conf 文件,我什么也得不到并且 http://example.com带我到http://example.com/myapp :

ProxyPass /j_spring_security_check http://localhost:8080/j_spring_security_check
ProxyPassReverse /j_spring_security_check http://localhost:8080/j_spring_security_check
ProxyPass / http://localhost:8080/myapp
ProxyPassReverse / http://localhost:8080/myapp

有人可以帮忙吗?谢谢。

编辑:

下面是我根据 How to set the context path of a web application in Tomcat 7.0 创建的“~/apache-tomcat-7.0.52/conf/Catalina/localhost”文件夹中的 ROOT.xml .

<Context
docBase="/home/anuj/webapps/prod-prop-3"
path=""
reloadable="true"
/>

但是当我尝试这个时,http://example.com带我到http://example.com/login并给出错误:

The requested URL /login was not found on this server.

这里有什么问题,有人可以帮忙吗?

最佳答案

使用以下代理设置修改 httpd.conf:

ProxyPass /j_spring_security_check http://localhost:8080/j_spring_security_check ProxyPassReverse /j_spring_security_check http://localhost:8080/j_spring_security_check ProxyPass /myapp http://localhost:8080/

ProxyPassReverse /myapp http://localhost:8080/

关于spring - 带有 Proxypass 和 Spring Security 的 Apache,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28670450/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com