The problem is this:I am used to adding "wp-admin" directly after the blog address to enter the wordpress background, but after entering it, I find that no matter which one of the management sub-items I click,All 404 (page not found), I was stunned instantly,This is the situation of Shenma.. .

It's easy to know where the problem is,And the answer is definitely on the redirect rules of nginx,But I do n’t know how to change it,But I also know that wordpress has definitely solved it,So I went to check the documents calmly.. . got it


#add trailing slash to */wp-admin requests.

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

Sure enough, I found a solution on codex,Just simply add a line of slash to redirect,The methodology is summarized as follows:

1. Login to the shell, vim edit the "wordpress.conf" under the nginx configuration directory (usually in/usr/local/nginx/conf /). Of course, if you use a conf file written by yourself like me, change The corresponding redirection configuration file is just fine.

vim /usr/local/nginx/conf/wordpress.conf

2. Just add the official line to the end of the file.

if (-f $request_filename/index.html) {
rewrite (. *) $1/index.html break;
if (-f $request_filename/index.php) {
rewrite (. *) $1/index.php;
if (! -f $request_filename) {
rewrite (. *) /blog/index.php;
rewrite/wp-admin $$scheme://$host $uri/permanent;

3:wq save and restart nginx

In fact, if you are lazy,Just use "echo>" to append ==

ps:It is said that nginx will not automatically add a slash at the end of the request,It does not automatically determine whether the request is a file or a directory.Searching the web for nginx slashes will mention that you need to add this slash to the end of the request.

Most of the information on the Internet is written like this:

Add location/() index index.html in nginx \ conf \ vhost.conf and add

if (-d $request_filename) {
 rewrite ^/(. *) ([^ /]) $http://$host/$1 $2/permanent;

But if your website is followed by a port,Then there will still be a 403 error when turning.

That is, the $host variable has lost the port,Change it to $http_host variable

Change to the following to solve all problems

if (-d $request_filename) {
 rewrite ^/(. *) ([^ /]) $http://$http_host/$1 $2/permanent;
  • Previous Implementation method of scaling imageView image developed by Android
  • Next Detailed JavaScript reference types and basic types