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]

# END WordPress

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

Thanks in advance!

  • Did you try acessing directly the backend and seeing if indeed there is a timeout when posting? – coredump Feb 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
  • did you manage to solve this problem ? i am facing the same issue with nginx reverse proxying an apache server – N Jay Mar 4 '18 at 12:06
  • 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)
  • 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.


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.