精选文章 -->
精选帝国cms程序批量替换:http头和图片路径方法 精选宝塔面板屏蔽垃圾搜索引擎蜘蛛和扫描工具的办法 精选帝国CMS7.5怎么支持php7.4版本的方法(已测试) 精选301重定向详解 精选wordpress文章中微信打赏功能的2种实现方法
这篇文章主要介绍了Nginx的Z-Blog的伪静态配置方法,需要的朋友可以参考下
本站是在LNMP环境下运行,参考Nginx的Z-Blog的静态配置
复制代码
代码如下:
server {
listen 80;
server_name jb51.net blog.jb51.net www.jb51.net;
root /www/web/www_jb51_net/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;
}
}
本站是在LNMP环境下运行,参考Nginx的Z-Blog的静态配置
复制代码
代码如下:
server {
listen 80;
server_name jb51.net blog.jb51.net www.jb51.net;
root /www/web/www_jb51_net/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;
}
}
上一篇:ZBLOG一些实用使用技巧分享