欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

504 gateway time-out nginx nginx apache 504 Gateway Time-Out after publishing on a Nginx-Apache-WordPress platform

I've set up a blog with WordPress and with Nginx acting as a proxy reverse for Apache. Everything goes really well, but there's a little problem.

When I write a new post, I can save the draft and everything works fine. But if I clic on the Publish button, the server gives a "504 Gateway time-out" error (Nginx 0.7.65 on the line below).

The strange things is that the post is indeed published if I visit my blog, there are no mistakes, everythings works right the way it should. So I just come back to my admin page and there it is, the post is listed as published, as if the 504 error was a little warning.

I think the problem has something to do with PHP (don't have PHP-FPM, just a normal install of php5 -btw, everything is under Ubuntu 10.04 LTS) or maybe with the Apache .htaccess file I've got inside the root of the blog, which is the typical .htaccess:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

# protect wpconfig.php
<files wp-config.php>
order allow,deny
deny from all
</files>

Thanks in advance!

shareimprove this questionasked Feb 16 '11 at 12:01javipas65721435


   Did you try acessing directly the backend and seeing if indeed there is a timeout when posting? – coredumpFeb 16 '11 at 12:37   I don't know exactly what do you mean :( I publish from the backend, and the message appears after publishing the post on the WordPress backend... – javipas Feb 16 '11 at 22:30

3 Answers 正确答案

  • set proxy_read_timeout and proxy_send_timeout to 60

  • check nginx error log "/var/log/nginx/error.log"(commonly)

  • check Apache error log "/var/log/nginx/error.log"(commonly)

shareimprove this answeranswered Feb 16 '11 at 12:49ooshro8,4722225

   Adding the timeouts didn't help, the problem is still there. I've tried to check nginx and apache error logs, but haven't seen anything weird yet. I'll keep on searching for hints. Thx anyway – javipas Feb 16 '11 at 22:31

If it only happens when you publish a post, check your list of ping servers in Settings -> Writing. Cleaning that list did the trick for me.

shareimprove this answeranswered Jan 13 '12 at 9:16pt2ph813717

Check if you are being redirected to a weird address such as the backends ip, localhost, 127.0.0.1 or something similar. Check your proxy_redirect sentence in nginx's config

shareimprove this answeranswered Feb 22 '11 at 21:57Ochoto1,088712

add a comment





普通分类: