gpt4 book ai didi

java - 使用 Apache HTTP 服务器前端 Tomcat

转载 作者:行者123 更新时间:2023-11-28 22:52:45 25 4
gpt4 key购买 nike

Apache Tomcat server.xml:

<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
This connector uses the NIO implementation that requires the JSSE
style configuration. When using the APR/native implementation, the
OpenSSL style configuration is required as described in the APR/native
documentation -->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
-->

<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" address="127.0.0.1" enableLookups="false" protocol="AJP/1.3" redirectPort="8443" />

Apache Http 服务器 httpd.conf :

cd /path/to/apache/config

LoadModule proxy_module       modules/mod_proxy.so       
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
ProxyRequests Off
<Proxy *>
Order deny,allow
Deny from all
Allow from localhost
</Proxy>
ProxyPass / ajp://127.0.0.1:8009/ retry=0
ProxyPassReverse / ajp://127.0.0.1:8009/ retry=0

当我做 http://[ip]/[app_name]我有这个错误:

Forbidden

You don't have permission to access /[app_name] on this server.

为什么?

最佳答案

你的配置状态

<Proxy *>
Order deny,allow
Deny from all
Allow from localhost
</Proxy>

猜猜DenyAllow的意思。如果您来自同一台服务器并使用 localhost 作为您的地址,您的配置应该有效。使用 IP 地址时要小心:通常 localhost 不再映射到 127.0.0.1,而是映射到 ::1,它的 IPV6 等价物。

编辑:删除此 block 并尝试它是否有效。

请注意,Stackoverflow 用于解决与编程相关的问题,这更像是服务器管理,因此在 https://serverfault.com/ 上可能会更好- 我正在投票将其转移到该站点。人们可能会走得更远-例如提示不要为互联网上任何地方的每个人打开反向代理。

关于java - 使用 Apache HTTP 服务器前端 Tomcat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35314066/

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