V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
dxhuii
V2EX  ›  Wikipedia

MediaWiki 图片显示正常。但点击图片打开链接 404 了?

  •  
  •   dxhuii · 2015-04-22 19:16:36 +08:00 · 4588 次点击
    这是一个创建于 3263 天前的主题,其中的信息可能已经有所发展或是发生改变。

    http://www.99496.com/wiki/文件:9ad6aaed513b73148b7d49f70afcfb32.jpg 这样会404 是什么问题,打开地址是这样的,看到别人家的,这样打开是能打开图片的。我这个是哪里配置不对吗?第一次用这个程序。

    第 1 条附言  ·  2015-04-23 14:43:21 +08:00
    刚刚把wiki 换成了baike 以前安装目录和伪静态目录一样,以为是这个问题,但换了之后,还是不行,还是404,不知道错在哪里,目前就发现在图片不能显示外,其他都正常。
    6 条回复    2015-04-23 16:10:16 +08:00
    Koell
        1
    Koell  
       2015-04-22 20:13:57 +08:00
    大概是伪静态配置问题。
    http://www.99496.com/wiki/index.php?title=%E6%96%87%E4%BB%B6:9ad6aaed513b73148b7d49f70afcfb32.jpg
    好久没配置mw了不清楚。
    dxhuii
        2
    dxhuii  
    OP
       2015-04-23 13:54:02 +08:00
    @Koell 那 NGINX的伪静态规则是什么样的?
    dxhuii
        3
    dxhuii  
    OP
       2015-04-23 13:58:59 +08:00
    @Koell 我也是第一次用。从网络上找到的伪静态规则。发出来你看一下。还缺什么:if (!-e $request_filename){
    rewrite ^/wiki/(.*)$ /wiki/index.php?title=$1&$args;
    }
    dxhuii
        4
    dxhuii  
    OP
       2015-04-23 13:59:59 +08:00
    @Koell 我也是第一次用。从网络上找到的伪静态规则。发出来你看一下。还缺什么:

    if (!-e $request_filename){
    rewrite ^/wiki/(.*)$ /wiki/index.php?title=$1&$args;
    }
    Koell
        5
    Koell  
       2015-04-23 14:55:17 +08:00
    @dxhuii 渣渣没配置过nginx,不过把if (!-e $request_filename) { }去掉试试?这个是判断文件是否存在的。
    再多的就帮不了了,抱歉。
    dxhuii
        6
    dxhuii  
    OP
       2015-04-23 16:10:16 +08:00
    @Koell

    location / {
    if (!-e $request_filename) {
    rewrite ^/baike/(.*)$ /wiki/index.php?title=$1&$args;
    }
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
    try_files $uri /wiki/index.php;
    expires max;
    log_not_found off;
    }
    # Restrictions based on the .htaccess files
    location ^~ ^/(cache|includes|maintenance|languages|serialized|tests|images/deleted)/ {
    deny all;
    }
    location ^~ ^/(bin|docs|extensions|includes|maintenance|mw-config|resources|serialized|tests)/ {
    internal;
    }
    location ^~ /images/ {
    try_files $uri /wiki/index.php;
    }
    location ~ /\. {
    access_log off;
    log_not_found off;
    deny all;
    }


    这样就好了,我也不知道为什么就好了。图片就可以打开了。

    换了目录: http://www.99496.com/baike/文件:9ad6aaed513b73148b7d49f70afcfb32.jpg
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1537 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 17:01 · PVG 01:01 · LAX 10:01 · JFK 13:01
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.