Mediawiki nginx短链接配置

今天搭建了mediawiki,想做下url优化,看上去更加优美些,看了官方文档是讲将wiki配置成目录的样子.由于已经启用了带有wiki的域名不想带有这个目录,又仔细了找了下终于找到了相关配置.

server {
        listen       80;
        root /data/vhost/mediawiki;
        server_name  wiki.xxx.com;
        access_log  /data/weblog/wiki-access.log;
        error_log  /data/weblog/wiki-error.log;

        location / {
                index  index.php;
                try_files $uri $uri/ @rewrite;
        }
        location @rewrite {
                rewrite ^/(.*)$ /index.php;
        }

        location ^~ /maintenance/ {
                return 403;
        }

        location ~ \.php$ {
                include  fastcgi.conf;
                fastcgi_pass  127.0.0.1:9000;
                fastcgi_index index.php;
                try_files $uri @rewrite;
        }
}

添加以下到LocalSettings.php

$wgScriptPath	    = "";
$wgArticlePath      = "/$1";
$wgUsePathInfo      = true;
$wgScriptExtension  = ".php";

发表评论

电子邮件地址不会被公开。 必填项已用*标注

Captcha Code