ec2、tomcat7 和 503 错误
我有 Amazon 开箱即用的 Tomcat7 实例 (ami-518e4c38),向其部署了一个 war 文件,但不断收到 503 错误。
我已将连接器设置为侦听 server.xml 中的端口 80,在默认安全组中,我将 80 (HTTP) 设置为 0.0.0.0/0
我假设我不必手动启动/停止 tomcat ,应该在实例启动时启动。我对这一点正确吗?
当我在端口 80 上 ping localhost(同时 ssh 进入实例)两次时,我得到:
2 packets transmitted, 2 received, 0% packet loss, time 999ms
任何帮助将不胜感激。
I have Amazon's out of the box instance with Tomcat7 (ami-518e4c38), deployed a war file to it, but keep getting 503 error.
I've set the connector to listen on port 80 in server.xml, in the default security group I got 80 (HTTP) set to 0.0.0.0/0
I'm assuming that I don't have to start/stop tomcat manually, should start when the instance is launched. Am I correct on this one?
When I ping localhost (while ssh'ed into the instance ) 2 times on port 80 I get:
2 packets transmitted, 2 received, 0% packet loss, time 999ms
Any help will be most appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
说真的,这不是一个答案,您应该描述您最初的情况以及您在答案中所做的事情并接受它。
我只是想弄清楚发生了什么,我需要您的反馈来了解更多信息。
最初你有一个503错误,这意味着服务不可用,通常Tomcat配置在Apache后面,我的意思是Apache服务器获取(所有)请求并可能将(部分)它们转发到Tomcat(如果配置为这样做)。
如果您收到 503 错误,则意味着有某个服务器已启动并正在运行来回复您,而该服务器应该是 Apache。如果我关闭 Tomcat 并尝试请求一个将转发到 Tomcat 的 URL,我会得到:
这就是为什么我的第一个想法是检查 Tomcat 是否正在运行。然后你就这么做了:
你发现 tomcat 实际上正在运行:
另一个原因可能是 Tomcat-Apache 连接配置不正确。然而,随后您发布了 Tomcat 尝试绑定端口 80 并失败的消息:
I尝试复制该错误,我进入我的
conf/server.xml
文件并将连接器更改为侦听端口 80 而不是8080:我启动 tomcat 并监视日志:
我得到一个与您得到的类似的异常,但不完全相同:
现在,如果我检查 Tomcat 是否正在运行,我发现它确实正在运行。虽然没有检查,但我认为在这种情况下,服务器会放弃并退出。就我而言,更正方法是,要么关闭 Apache 并直接使用 Tomcat(这对于高流量站点来说是不可取的),要么将 Tomcat 移回端口 8080 并安装 mod_jk。
mod_jk的安装可以实现Apache和Tomcat之间的通信。然后,在虚拟主机配置中,我将安装一个文件夹或根文件夹,并在必要时进行一些 URL 重写:
一切都应该正常。不过,我不确定你是如何解决绑定错误的,你没有说。
Seriously, this isn't an answer, you should describe your initial situation and what you did in your answer and accept it.
I just want to clear up what happened, and I would need your feedback to understand more about it.
Initially you had a 503 error, which means service unavailable, normally Tomcat is configured behind Apache, and with this I mean that the Apache server gets (all) the requests and may forward (some of) them to Tomcat, if configured to do so.
If you get a 503 error, it means there is some server up and running to reply to you and that should be Apache. If I shut down Tomcat and try to request an URL that would be forwarded to Tomcat I get:
That's why my first thought was to check if Tomcat was running. Then you did:
And you got that tomcat was actually running:
Another reason could be that the connection Tomcat-Apache is not configured correctly. However then you posted that Tomcat was trying to bind port 80 and failing:
I tried to replicate that error, I went in my
conf/server.xml
file and change the connector to listen on port 80 instead of 8080:I start tomcat and monitor the log:
And I get an exception that is similar to what you get, but not exactly the same:
Now if I check whether Tomcat is running I find that is indeed running. While without checking I'd have supposed that in a case like that the server would have just gave up and quit. In my case the correction would be, either shut down Apache and use Tomcat directly, which is not advisable for high traffic sites or move Tomcat back to port 8080 and install mod_jk.
The installation of mod_jk enables the communication between Apache and Tomcat. Then in the virtual host configuration I'd mount a folder or the root folder and do some URL rewriting if necessary:
And everything should work. However, I am not sure how you solved the bind error, you didn't say.