虽然我使用 Ubuntu 12.04 没有遇到任何问题,但在全新安装的 14.04 中,我无法将 Tomcat 中的应用程序从端口 8080 代理到 80。我在 apache.conf 中添加了以下内容:
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /myapp http://localhost:8080/myapp
ProxyPassReverse /myapp http://localhost:8080/myapp
但我收到了错误:
[proxy:error] (110)Connection timed out: AH00957: HTTP: attempt to connect to 127.0.0.1:8080 (localhost) failed
[proxy:error] ap_proxy_connect_backend disabling worker for (localhost) for 60s
[proxy_http:error] AH01114: HTTP: failed to make connection to backend: localhost
我尝试了几种配置但连接总是超时。
答案1
iptables
此问题与阻塞环回端口有关。我需要添加:
sudo iptables -I INPUT 1 -i lo -j ACCEPT