htaccess – Nginx subdirectory: wordpress wp-login redirects to 404 not found

server {
location / {
try_files $ uri $ uri / @ extensionless-php;
}
location / shop {
try_files $ uri $ uri / /shop/index.php?q=$uri&$args /shop/index.php?q=$uri&$args;
}
location ~  .php $ {
if ($ request_uri ~ (. *) . php $)
{
returns $ 301 1;
}
try_files $ uri = 404;
include /etc/nginx/fastcgi.conf;
fastcgi_pass unix: /run/php/php7.0-fpm.sock;

}
location @ extensionless-php {
rewrite ^ (. *) $ $ 1.php last;
}

The code above is used in the nginx server file. I have WordPress installed in a subdirectory. When i try to connect to my dashboad using a username and password via the wp-login.php page, it redirects to 404 not found. The other pages of the wordpress blog work well. I can not access only my dashboard. Please help me solve the problem. Thank you in advance.