1

我无法让 MediaWiki 在 Nginx 上工作。我在我的 /var/www/domain.com/htdocs/wiki 目录和我的 wiki.domain.com 子域中有它。

我尝试了许多在互联网上找到的虚拟主机示例,例如:

server {
server_name wiki.domain.com;
root /var/www/domain.com/htdocs/wiki;
index index.html index.php;
autoindex off;

location / {
 index index.php5;
 error_page 404 = @wiki;

}

location @wiki {
    rewrite ^/([^?]*)(?:\?(.*))? /index.php5?title=$1&$2 last;
}

location ~ \.php5?$ {
    include /etc/nginx/fastcgi.conf;
    include /etc/nginx/fastcgi_params;    
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php5;     
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

}

或其他:

server {
server_name wiki.domain.com;
root /var/www/domain.com/htdocs/wiki;

client_max_body_size 5m;
client_body_timeout 60;

# Remote index.php from URI
rewrite ^/index.php/(.*) /$1  permanent;

location / {
    if (!-e $request_filename) {
            rewrite ^/([^?]*)(?:\?(.*))? /index.php?title=$1&$2 last;
    }
    if ($uri ~* "\.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$") {
            expires max;
            break;
    }
}

location ~* \.php$ {
    if (!-e $request_filename) {
            return 404;
    }

    include /etc/nginx/fastcgi.conf;

    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;

    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
}

}

我得到 wiki.domain.com 的 403 Forbidden 和 wiki.domain.com/index.php 的 500 Internet Server Error

在我的 LocalSettings.php 中,我还设置了这个: $wgUsePathInfo = true;

你能帮助我吗..?我应该如何配置 vhost/localsettings 以使 MW 在 Nginx 上工作?

4

1 回答 1

0

好的,找到了问题:它与LyricExtension 有关!我禁用了它,一切都开始正常工作:)

于 2012-06-18T10:21:18.037 回答