Cannot log into WordPress on CentOS with nginx

  • Posted November 23, 2013

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?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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: <br> <br> <br> <br>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.

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. <br> <br> 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. <br> <br>I tried replacing the files, thinking maybe a file or two was incompletely copied, but that hasn’t changed anything. <br> <br>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.

<b>“Is that more clear?”</b> <br> <br>Yes! <br> <br><b>“… 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.”</b> <br> <br>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 <b>wordpress login page loop</b> (or something to that affect). <br> <br>Also, try this: <br> <br>1.) Enter your login credentials; <br>2.) When you’re redirected back to the Login Page; <br>3.) Enter <code></code> into your browser’s address bar & tap <code>Enter</code>. <br> <br>Does that take you into the WP Dashboard?

@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. <br> <br>@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?

The site seems to resolve OK and the login page appears OK. /wp-login/ or <br> <br>Can you elaborate on, “Its like it tries to redirect or something but can’t.” please? <br> <br>What happens when you enter your username and password? Screen grabs or exact errors please. <br> <br>

Even though your WordPress site is already installed, run through this tutorial to make sure you’ve covered all the basis: <a href=“”>How To Install Wordpress with nginx on CentOS 6</a>.