Cannot log into WordPress on CentOS with nginx

November 23, 2013 5.6k views
I've just setup my web server with the following: CentOS 6 64-bit nginx 1.5.6 php 5.5 php-fpm pagespeed APC Fail2Ban MariaDB 5.5 WP-CLI memcache I've run into a weird issue. I installed the software using a custom-made bash script and it has installed without errors (after two weeks of tweaking!). I've created my first site on the server, but I'm not able to log into WordPress. Its like it tries to redirect or something but can't. My nginx configs can be seen here: The site is here: I'm sure this is something simple like I forgot permissions or something in nginx config, but I've been at this for weeks and I'd like a second pair of eyes on this. Can someone take a look and help me find the issue, please?
6 Answers
Even though your WordPress site is already installed, run through this tutorial to make sure you've covered all the basis: How To Install Wordpress with nginx on CentOS 6.
by Etel Sverdlov
Wordpress is a free and open source website and blogging tool that uses php and MySQL. It was created in 2003 and has since then expanded to manage 22% of all the new websites created and has over 20,000 plugins to customize its functionality. This tutorial shows how to install Wordpress on a server with LEMP (with nginx instead of apache). It is written for Centos 6.
The site seems to resolve OK and the login page appears OK. /wp-login/ or

Can you elaborate on, "Its like it tries to redirect or something but can't." please?

What happens when you enter your username and password? Screen grabs or exact errors please.

@pablo - I've already run through that tutorial, thanks. Like I said, the WP files are download, in the correct directory, with the correct permissions (user and group are both the nginx user), the wp-config.php file and setup correctly, the database is created, and the site is displaying. The only issue is I can't actually log into the Dashboard and administrate the site through the GUI. I can see the files through SFTP and I can administrate the site through the command line (usiing WP-CLI), but I can't log into the site by going to the login page.

@Ben - Normally, when you go to the wp-login page, enter your credentials, and hit the Submit button, the page refreshes and you're sent to the Dashboard. In my case, I get sent back to the login with no errors. The URL changes from to On other servers (like my current web host - not at Digital Ocean), this page then redirects to So, its trying to redirect to the Dashboard, but for some reason, it doesn't. Is that more clear?
"Is that more clear?"


"... and hit the Submit button, the page refreshes and you're sent to the Dashboard. In my case, I get sent back to the login with no errors."

This is actually a not-too-uncommon WordPress problem. It's even happened to me b/f, but can't remember the fix @ the moment. I'll see if I can find it; but you're probably just as capable of Googl'ing wordpress login page loop (or something to that affect).

Also, try this:

1.) Enter your login credentials;
2.) When you're redirected back to the Login Page;
3.) Enter into your browser's address bar & tap Enter.

Does that take you into the WP Dashboard?
It does not. On other sites (not hosted on Digital Ocean) I manage, I've had to do that very thing and it works fine. On this one, it just takes me back to the login page again. was a site I hosted on my current host (not DO), so I cleared my cookies thinking maybe the cookies from my previous logins on the other host were somehow preventing me from logging with the site hosted on DO. Unfortunately, now I get an error message on the login page saying: "ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress." However, cookies are enabled in my browser. I tried to login in Firefox and Safari and get the same message in both. Cookies are enabled in all my browsers.

I tried replacing the files, thinking maybe a file or two was incompletely copied, but that hasn't changed anything.

I'm going to try commenting out each part of my nginx config to see if there's anything there preventing me from accessing the Dashboard.
Ok, after an exhaustive rewrite of my nginx config files, I found it. In the cache section of the main nginx.conf file, when I take out the fastcgi_hide_header line, I'm able to log in and log out and I don't get any warnings about cookies. This thread:

Makes it sounds like this is a Safari/Chrome bug. It also kinda sounds like these lines prevent cookies from being set, so I'm ok with removing it altogether.
Have another answer? Share your knowledge.