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
http://codex.wordpress.org/nginx
#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.
location/blog/{
}
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;
}
Related articles
- Method for perfectly implementing wordpress forbidden article revision and automatic saving
- Detailed configuration of WordPress multi-site function in Nginx environment
- Example of how to configure wordpress with nginx
- Installation method of SSL certificate under Linux Nginx and WordPress CDN configuration
- Multi-site support and Nginx rewrite rule configuration in WordPress
- Example of Nginx configuration rewrite rewrite rules for WordPress and Drupal
- i would like to know how to set the nuxt app as a subdirectory on the nginx server
- nginx - access by ip address is not redirected to your own domain
- web server - about the name when acquiring the domain server for hp production
- nginx - i want to dynamically correspond to locations
- nginx - ssl settings do not work
- i want to upload a web application created with php to a wordpress site and run it
- website - how wordpress theme editor works
- i don't understand the need for a web server such as nginx when deploying ruby on rails applications on ec2
- website - i want to renew my site using the same domain
- html - css can't be read/mime type doesn't change (wordpress)