Home > Backend Development > PHP Tutorial > WordPress configuration fixed link nginx access 404 problem solution

WordPress configuration fixed link nginx access 404 problem solution

WBOY
Release: 2016-07-29 08:56:20
Original
1615 people have browsed it

WordPress支持使用固定链接,但是在ngnix环境下,访问页面后出现404,

其实官方是有文档说明的,需要单独写配置,

我这边配置的示例代码如下:

server {
    listen       80;
    server_name  www.chaichunyan.com;

    access_log  /var/log/nginx/access.log  main;

location / {
        root /www/data/xxx;
        index  index.php index.html index.htm;

        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 (.*) /index.php;
         }
}
rewrite /wp-admin$ $scheme://$host$uri/ permanent;

    location  ~ \.php$ {
        root /www/data/xxx;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}
Copy after login

以上就介绍了wordpress配置固定链接nginx访问404问题解决方法,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template