Nginx pseudo-static setting rules for Bo-blog

Source: Internet
Author: User

The nginx pseudo-static setting rules of the following Bo-blog are the code snippets in nginx. conf of the letaotao tomato network, which are recorded here for future use.

server {  server_name www.letaotao.net.cn ;  rewrite ^(.*) http://letaotao.net.cn$1 permanent;}server {  listen       80;  server_name  letaotao.net.cn;  index index.html index.htm index.php;  root  /home/wwwroot/letaotao;  if (!-e $request_filename) {    rewrite "^/$" /blog last;    rewrite ^/blog/post/([0-9]+)/?([0-9]+)?/?([0-9]+)?/?$ /blog/read.php?entryid=$1&page=$2&part=$3 last;    rewrite ^/blog/page/([0-9]+)/([0-9]+)/?$ /blog/index.php?mode=$1&page=$2 last;    rewrite ^/blog/starred/([0-9]+)/?([0-9]+)?/?$ /blog/star.php?mode=$1&page=$2 last;    rewrite ^/blog/category/jianfei/?$ /blog/index.php?go=category_0 last;    rewrite ^/blog/category/fanqiehongsu/?$ /blog/index.php?go=category_1 last;    rewrite ^/blog/category/fanqiehongsu/([0-9]+)/([0-9]+)/?$ /blog/index.php?go=category_1&mode=$1&page=$2 last;    rewrite ^/blog/category/jianfei/([0-9]+)/([0-9]+)/?$ /blog/index.php?go=category_0&mode=$1&page=$2 last;    rewrite ^/blog/category_([0-9]+)/([0-9]+)/([0-9]+)/?$ /blog/index.php?go=category_$1&mode=$2&page=$3 last;    rewrite ^/blog/archiver/([0-9]+)/([0-9]+)/?([0-9]+)?/?([0-9]+)?/?$ /blog/index.php?go=archive&cm=$1&cy=$2&mode=$3&page=$4 last;    rewrite ^/blog/date/([0-9]+)/([0-9]+)/([0-9]+)/?([0-9]+)?/?([0-9]+)?/?$ /blog/index.php?go=showday_$1-$2-$3&mode=$4&page=$5 last;    rewrite ^/blog/user/([0-9]+)/?$ /blog/view.php?go=user_$1 last;    rewrite ^/blog/tags/([^/blog/]+)/?([0-9]+)?/?([0-9]+)?/?$ /blog/tag.php?tag=$1&mode=$2&page=$3 last;    rewrite ^/blog/component/id/([0-9]+)/?$ /blog/page.php?pageid=$1 last;    rewrite ^/blog/component/([^/blog/]+)/?$ /blog/page.php?pagealias=$1 last;    #Force redirection for old rules    rewrite ^/blog/read\.php/([0-9]+)\.htm$ http://$host/post/$1/ permanent;    rewrite ^/blog/post/([0-9]+)\.htm$ http://$host/post/$1/ permanent;    rewrite ^/blog/post/([0-9]+)\_([0-9]+)\.htm$ http://$host/post/$1/$2/ permanent;    rewrite ^/blog/post/([0-9]+)\_([0-9]+)\_([0-9]+)\.htm$ http://$host/post/$1/$2/$3/ permanent;    rewrite ^/blog/index\_([0-9]+)\_([0-9]+)\.htm$ http://$host/page/$1/$2/ permanent;    rewrite ^/blog/star\_([0-9]+)\_([0-9]+)\.htm$ http://$host/starred/$1/$2/ permanent;    rewrite ^/blog/category\_([0-9]+)\.htm$ http://$host/category/$1/ permanent;    rewrite ^/blog/category\_([0-9]+)\_([0-9]+)\_([0-9]+)\.htm$ http://$host/category/$1/$2/$3/ permanent;    rewrite ^/blog/archive\_([0-9]+)\_([0-9]+)\.htm$ http://$host/archiver/$1/$2/ permanent;    rewrite ^/blog/archive\_([0-9]+)\_([0-9]+)\_([0-9]+)\_([0-9]+)\.htm$ http://$host/archiver/$1/$2/$3/$4/ permanent;    rewrite ^/blog/showday\_([0-9]+)\_([0-9]+)\_([0-9]+)\.htm$ http://$host/date/$1/$2/$3/ permanent;    rewrite ^/blog/showday\_([0-9]+)\_([0-9]+)\_([0-9]+)\_([0-9]+)\_([0-9]+)\.htm$ http://$host/date/$1/$2/$3/$4/$5/ permanent;    #Filename alias    rewrite ^/blog/([a-zA-Z0-9_-]+)/?([0-9]+)?/?([0-9]+)?/?$ /blog/read.php?blogalias=$1&page=$2&part=$3 last;    rewrite "/news/s.php/([0-9]+)" /news/s.php?id=$1 break;    rewrite "/news/c.php/([0-9]+)" /news/c.php?id=$1 break;    rewrite "/news/r.php/([0-9]+)" /news/r.php?id=$1 break;  }  location ~ .*\.(php|php5)?$ {    fastcgi_pass  unix:/tmp/php-cgi.sock;    #fastcgi_pass  127.0.0.1:9000;    fastcgi_index index.php;    include fcgi.conf;  }  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {    expires      30d;    access_log off;  }  location ~ .*\.(js|css)?$ {    expires      15d;  }  access_log  /home/wwwlogs/letaotao.net.cn.log  access;}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.