我有一个使用Spring Security进行登录的Spring MVC应用程序。我使用Apache Webserver作为代理和Tomcat。下面是我的/etc/apache2/sites-enabled/example.com.conf文件:Apache与Proxypass和Spring Security
ServerAdmin [email protected]
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目录/卡塔利娜/本地主机” 文件夹中的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.
什么是这里的问题,可以有人帮忙吗?
它不工作。如果我尝试http://example.com,我会得到索引列表。如果我尝试http://example.com/myapp,则不显示任何内容。 – AAgg 2015-02-23 13:41:34