ZBlog使用Nginx搭建网站时,伪静态怎么配置?以下是小编为大家分享的伪静态代码,快来看看吧!
server { listen 80; server_name www.domain.com; root /www/web/www_domain_com/public_html; index index.html index.php index.htm; error_page 400 /errpage/400.html; error_page 403 /errpage/403.html; error_page 404 /errpage/404.html; location ~ \.php$ { proxy_pass http://127.0.0.1:88; include naproxy.conf; #include ./rewrite/z-blog_nginx.conf; rewrite ^/post/([0-9] ).html$ /index.php?id=$1 last; rewrite ^/([0-9] ).html$ /index.php?id=$1 last; rewrite ^/(?:page_)?([0-9]*).html$ /index.php?page=$1 last; rewrite ^/category-([0-9] )(?:_)?([0-9]*).html$ /index.php?cate=$1&page=$2 last; rewrite ^/date-([0-9-] )(?:_)?([0-9]*).html$ /index.php?date=$1&page=$2 last; rewrite ^/author-([0-9] )(?:_)?([0-9]*).html$ /index.php?auth=$1&page=$2 last; rewrite ^/tags-([0-9] )(?:_)?([0-9]*).html$ /index.php?tags=$1&page=$2 last; } location / { try_files $uri @apache; } location @apache { proxy_pass http://127.0.0.1:88; include naproxy.conf; } } |
文件路径根据自己情况去更改就行,希望可以帮助到您!