Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question
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
up vote 2 down vote accepted
  • 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)
share|improve this answer
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

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

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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