nginx相关参数配置备忘

(暂未验证正确性)

discuz论坛重写参数

location / {
if (!-e $request_filename) {
rewrite ^/archiver/((fid|tid)-[\w\-]+\.html)$ /archiver/index.php?$1 last;
rewrite ^/forum-([0-9]+)-([0-9]+)\.html$ /forumdisplay.php?fid=$1&page=$2 last;
rewrite ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /viewthread.php?tid=$1&extra=page%3D$3&page=$2 last;
rewrite ^/space-(username|uid)-(.+)\.html$ /space.php?$1=$2 last;
rewrite ^/tag-(.+)\.html$ /tag.php?name=$1 last;
break;
}
}

防盗链

location ~* ^.+\.(gif|jpg|png|swf|flv|rar|zip)$ {
valid_referers none blocked server_names *.onono.org http://localhost;
if ($invalid_referer) {
rewrite ^/ http://error.org/images/error.gif;
return 403;
}
}

WordPress

# SEO friendly URLs for WordPress
#
location / {
root /path/to/YOURDIRECTORY/public_html/forums;
index index.php;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?q=$1 last;
}
}

发表评论

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

*


*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>