WordPress与Drupal的Nginx配置rewrite重写规则示例


本文整理自网络,侵删。

WordPress

wordpress依然是目前是世界上最流行的博客系统,越来越多由wordpress搭建而成的网站在使用nginx服务器软件,这里就来分享一下WordPress的nginx重写规则:
 

  server {
    listen    80;
    server_name www.1000zx.cn jb51.net;
    access_log /data/logs/nginx/www.1000zx.cn.access.log main;
 
    index index.html index.php;
    root /data/site/www.1000zx.cn;
location / {
    try_files $uri $uri/ /index.php?$args;
    add_header Pragma "public";
    expires 12h;
}
 
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
 
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
    access_log off;
      log_not_found off;
      expires max;
}
 
 
location ~ \.php$ {
    try_files $uri =404;
 
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
 
    include fastcgi_params;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#    fastcgi_intercept_errors on;
    fastcgi_pass 127.0.0.1:9000;
}
 
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
    expires 24h;
    access_log off;
}
 
location ~ .*\.(js|css)$
{
    expires 24h;
    access_log off;
}

 重启你的nginx即可

阅读剩余部分

相关阅读 >>

基于vue.js与wordpress rest api构建单页应用详解

使用php+ajax让wordpress动态加载文章的教程

wordpress博客搜索关键词高亮显示实现代码

详解wordpress中的头像缓存和代理中的缓存更新方法

如何设置wordpress图片防盗链方法 推荐

wordpress在安装使用中出现404、403、500及502问题的分析与解决方法

深入解析wordpress中加载模板的get_template_part函数

wordpress实现网站投稿者也可以上传图片的方法

nginx服务lnmp之wordpress部署流程步骤

wordpress中文截断产生乱码解决方法

更多相关阅读请进入《wordpress》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...