+ -
当前位置:首页 → 问答吧 → ubuntu下实现nginx + tmpfs 替代缓冲服务器

ubuntu下实现nginx + tmpfs 替代缓冲服务器

时间:2011-09-16

来源:互联网

sudo vi /usr/local/nginx/conf/nginx.conf
打开配置文件,找到所需要配置的server,添加伪静态
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /var/www/;
index index.php index.html index.htm;
rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;
rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last;
if (!-e $request_filename) {
return 404;
}
}
重启nginx
之后在discuz的配置管理中心打开伪静态,全局/SEO/URL静态化,把需要伪静态化的打上勾。
附件:
文件注释: 勾选之后提交

2011-09-15_234512.png [ 20.89 KiB | 被浏览 9 次 ]

作者: Conan304   发布时间: 2011-09-16