我已经安装了 mediawiki。除了我尝试为外部目录(webalizer web stats)起别名外,世界上一切都很好。我看到 Nginx 将请求传递/usage/*
给 PHP/Mediawiki。我不想要那个。我真的希望 /usage/ 下的所有内容都指向我的别名,而不是别的。与 Mediawiki 代码和功能完全分离。
# in no way related to Mediawiki. I just want to serve this as static HTML.
location /usage {
alias /var/www/webalizer/wiki.longnow.org/;
}
# This answers to anything, which may be my problem
location / {
try_files $uri $uri/ @rewrite;
index index.php;
}
# A special rewrite to play nicely with Mediawiki
location @rewrite {
rewrite ^/(.*)$ /index.php?title=$1&$args;
}
# PHP, nom nom nom
location ~ \.php$ {
include fastcgi_params;
fastcgi_index index.php;
fastcgi_pass unix:/tmp/php-fastcgi.socket;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
我希望在其余部分之前列出 /usage 位置指令会使系统短路,但我被 Django 宠坏了;)