Search code examples
phpwordpressnginxadminpanel

WordPress wrong redirect while accessing wp-admin


I have a little problem. Now, I'm migrating my WordPress site from Apache2 to Nginx. Everything works fine, but not admin panel.

When I try to access '/wp-admin' I have the following redirect:

http://domain.com/wp-login.php?redirect_to=http%3A%2F%2Fdomain.com%2Fwp-admin%2F&reauth=1

After that a blank page appears and nothing else. I have checked PHP configuration and sample test.php is printing something so it works. What I'm doing wrong?

Here is my Nginx config:

server
{
listen 155.123.12.222:80;
server_name domain.com www.domain.com ;
access_log /var/log/nginx/domains/domain.com.log;
access_log /var/log/nginx/domains/domain.com.bytes bytes;
error_log /var/log/nginx/domains/domain.com.error.log;
root /home/admin/domains/domain.com/public_html;
index index.php index.html index.htm;

location / {
    index index.php;
    try_files $uri $uri/ /index.php?q=$uri&$args;
}

rewrite /wp-admin$ $scheme://$host$uri/ permanent;

location /wp-admin {
    index index.php index.html index.htm;
    try_files $uri /wp-admin/index.php?q=$uri&$args;
}

location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
    expires 24h;
    log_not_found off;
}


location ~ /\. { access_log off; log_not_found off; deny all; }

location ~ \.php$
{
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    include /etc/nginx/fastcgi_params;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include /etc/nginx/nginx_limits.conf;
        if (-f $request_filename)
        {
            fastcgi_pass unix:/usr/local/php56/sockets/admin.sock;
        }
}

location ~ /\.ht
{
    deny all;
}
include /etc/nginx/webapps.conf;
}

Solution

  • Ok, I found a solution. I have turned on a DEUB mode in wp-config.php. There was a bad configuration in some plugin, so I changed it.

    Anyway, thanks for your attention guys.