简体   繁体   English

带有nginx + fastcgi的504网关超时django站点

[英]504 gateway timeout django site with nginx+fastcgi

we added ability for admin users to change server date&time through the portal. 我们为管理员用户增加了通过门户更改服务器日期和时间的功能。 Changing the date&time back is working fine, but changing forward(more than fastcgi_read_timeout) is returning '504 gateway timeout' even though server time successfully changed behind the scenes. 改回日期和时间工作正常,但是向前修改(大于fastcgi_read_timeout)将返回“ 504网关超时”,即使服务器时间在后台成功更改也是如此。

Please advice how to handle this? 请咨询如何处理?

Thanks. 谢谢。

I had a very similar issue with another project. 我在另一个项目中遇到了非常相似的问题。 Maybe it is best to submit the date&time credentials (I assume you would be using NTP servers IPs to do this) through the portal asynchronously via a JavaScript AJAX request. 也许最好通过JavaScript AJAX请求通过门户异步提交日期和时间凭据(我假设您将使用NTP服务器IP来执行此操作)。 Then, let the server then do its thing with the date&time. 然后,让服务器使用日期和时间执行其操作。

Meanwhile, have the client side JavaScript, continuously probe the server with interval AJAX requests (perhaps every 5 seconds) to get back a response message on the server time. 同时,使用客户端JavaScript,以间隔的AJAX请求(也许每5秒一次)连续探测服务器,以获取有关服务器时间的响应消息。 That way, each subsequent AJAX request initiates a new Nginx session and if the first fails/timeouts, then try a second time, if that fails, then try a third time, and so on. 这样,每个后续的AJAX请求都会启动一个新的Nginx会话,如果第一个失败/超时,则尝试第二次,如果失败,则尝试第三次,依此类推。

This worked on our system. 这在我们的系统上起作用。 However, I do not know if your product has login/authentication credentials. 但是,我不知道您的产品是否具有登录/身份验证凭据。 If it does, then the user may have to log back in once all set and done because a change in time may also expire their log-in session. 如果是这样,则用户可能必须重新设置并完成一次登录,因为时间上的更改也可能使他们的登录会话到期。 I don't think this is such a big deal though because theoretically they should only need to change the date/time once in a while if not just one time only. 我认为这没什么大不了的,因为从理论上讲,他们只需要偶尔更改一次日期/时间(即使不是一次)。 So it shouldn't have too much of an impact on the user experience. 因此,它不会对用户体验产生太大影响。

tags: nginx, NTP, timeout, 504 标签:nginx,NTP,超时,504

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM