› NGINX
› NGINX Trac
› 3rd Party Modules
› Security Advisories
› CHANGES
› OpenResty
› ngx_lua
› Tengine
在线学习资源
› NGINX 开发从入门到精通
NGINX Modules
› ngx_echo
holinhot
V2EX  ›  NGINX

wordpress nginx 伪静态问题

  •  
  •   holinhot · Mar 8, 2015 · 3989 views
    This topic created in 4262 days ago, the information mentioned may be changed or developed.

    配置了以下规则
    rewrite ^./files/(.)$ /wp-includes/ms-files.php?file=$1 last;
    if (!-e $request_filename) {
    rewrite ^.+?(/wp-.) $1 last;
    rewrite ^.+?(/.
    .php)$ $1 last;
    rewrite ^ /index.php last;
    }

    网站没什么不正常的地方
    但是wordpress已经内置了一个404页面在apache下运行正常
    但是nginx下404页面显示的是nginx的404页面而不是wordpress内置的404页面这是怎么会事

    7 replies  •  2015-03-09 01:52:14 +08:00
    kn007
    kn007
    Mar 8, 2015❤️1
    1
    添加 try_files $uri =404;
    示例:
    location ~ .*\.php?$ {
    try_files $uri =404;
    fastcgi_pass unix:/tmp/php-cgi.sock;
    fastcgi_index index.php;
    include fastcgi.conf;
    }
    holinhot
    holinhot
    OP
    Mar 8, 2015
    2
    @kn007 \.php?要加到这个区域?
    holinhot
    holinhot
    OP
    Mar 8, 2015
    3
    @kn007 location / {
    try_files $uri $uri/ /index.php?$args;
    try_files $uri =404;
    } 看起来不行
    holinhot
    holinhot
    OP
    Mar 8, 2015
    4
    已搞定 要加到php区域
    kn007
    kn007
    Mar 8, 2015
    5
    添加到php区域,还有不能同事tryfiles,要合并
    如try_files $uri $uri/ /index.php?$args =404;
    ab
    ab
    Mar 8, 2015
    6
    location / {
    try_files $uri $uri/ /index.php?$args;
    }

    这段搞定一切,不用加到php段
    ryd994
    ryd994
    Mar 9, 2015 via Android
    7
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1561 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 215ms · UTC 15:16 · PVG 23:16 · LAX 07:16 · JFK 10:16
    ♥ Do have faith in what you're doing.