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 · 3794 views
    This topic created in 4166 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
        1
    kn007  
       Mar 8, 2015   ❤️ 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
        2
    holinhot  
    OP
       Mar 8, 2015
    @kn007 \.php?要加到这个区域?
    holinhot
        3
    holinhot  
    OP
       Mar 8, 2015
    @kn007 location / {
    try_files $uri $uri/ /index.php?$args;
    try_files $uri =404;
    } 看起来不行
    holinhot
        4
    holinhot  
    OP
       Mar 8, 2015
    已搞定 要加到php区域
    kn007
        5
    kn007  
       Mar 8, 2015
    添加到php区域,还有不能同事tryfiles,要合并
    如try_files $uri $uri/ /index.php?$args =404;
    ab
        6
    ab  
       Mar 8, 2015
    location / {
    try_files $uri $uri/ /index.php?$args;
    }

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