标签:nginx 504 504 gateway time-out jenkins部署 tomcatredeploy 504
环境:jenkins+maven+nginx+tomcat
在执行jenkins job发布项目到远程服务器,服务器使用nginx+tomcat。默认使用80端口,通过nginx转发请求。在执行tomcat:redeploy时,出现下面的错误:
[ERROR] Failed toexecute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:redeploy (default-cli)on project sgt-node: Cannot invoke Tomcat manager: Server returned HTTPresponse code: 504 for URL: http://host/manager/text/deploy?path=%2Fnode&war=&update=true-> [Help 1] [ERROR] [ERROR] To see thefull stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Mavenusing the -X switch to enable full debug logging. [ERROR] [ERROR] For moreinformation about the errors and possible solutions, please read the followingarticles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
但项目又是部署成功了的,只是jenkins的job执行失败。刚开始一直以为是tomcat的连接超时了,设置connectionTimeout为-1时(keepAliveTimeout默认使用connectionTimeout的值),即永不超时,错误依旧。那是不是nginx连接的超时了呢?所以设置了nginx的keepalive_timeout参数,但还是没有效果。
后来经过多番查找资料(对nginx不熟),查看到nginx的错误日志(error_log),发现下面错误:
2014/05/16 11:23:03[error] 4789#0: *36073 upstream timed out (110: Connection timed out) whilereading response header from upstream, client: 172.16.77.102, server:172.16.73.53, request: "PUT/manager/text/deploy?path=%2Fnode&war=&update=true HTTP/1.0",upstream:"http://127.0.0.1:8080/manager/text/deploy?path=%2Fnode&war=&update=true",host: "host"
知道了原因后就好办了,查了一下资料,设置nginx代理的读取超时时间参数:
proxy_read_timeout 600s;
另外,如果不使用nginx代理转发请求,也可避免这个问题,直接使用http://host:port/manager/text,只要不使用nginx默认的80端口即可。
jenkins在使用maven部署到nginx+tomcat服务器时出现504错误,布布扣,bubuko.com
jenkins在使用maven部署到nginx+tomcat服务器时出现504错误
标签:nginx 504 504 gateway time-out jenkins部署 tomcatredeploy 504
原文地址:http://blog.csdn.net/mhmyqn/article/details/26015665