2016-02-10 112 views
0

的Apache Tomcat的server.xml:前移的Tomcat与Apache HTTP服务器

<!-- 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]我有这个呃ror:

Forbidden

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

为什么?

+0

'拒绝所有'/'允许从本地主机'?除非你使用'127.0.0.1'或'1'作为[ip]' –

+0

@OlafKock作为[ip]我使用这个http://172.12.6.3/Myapp – Mercer

+0

然后我将这个评论成为答案... –

回答

1

你的配置状态

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

猜的DenyAllow意义。如果您来自同一服务器并使用localhost作为您的地址,则您的配置应该可以正常工作。小心如果您使用IP地址:通常localhost不再映射到127.0.0.1,而是::1,其IPV6等效。

编辑:删除此块,然后尝试它是否工作。

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

+0

so我应该做什么改变? – Mercer

+0

编辑并投票将此问题转移到serverfault.com –