web建站教程
  1. 首页
  2. vuejs
  3. js
  4. 好玩
  5. seo教程
  6. 前端知识
  7. 百度echarts
  8. 更多
    php入门
    nodejs
    mockjs
    reactjs
    mysql
    wordpress
    织梦cms
    帝国cms
    git教程
    IT知识
    模板大全
    休息站

wordpress如何实现nginx多站重写规则

374 ℃
     

wordpress如何实现nginx多站点rewrite重写规则,下面web建站小编给大家详细介绍一下具体实现方法!

wordpress实现多站点子目录重写规则

map $uri $blogname{
  ~^(?P/[^/]+/)files/(.*)	$blogpath ;
}
 
map $blogname $blogid{
  default -999;
 
  #Ref: http://wordpress.org/extend/plugins/nginx-helper/
  #include /var/www/wordpress/wp-content/plugins/nginx-helper/map.conf ;
}
 
server {
  server_name ipkd ;
 
  root /var/www/ipkd/htdocs;
  index index.php;
 
  #多站点配置
  location ~ ^(/[^/]+/)?files/(.+) {
    try_files /wp-content/blogs.dir/$blogid/files/$2 /wp-includes/ms-files.php?file=$2 ;
    access_log off;  log_not_found off; expires max;
  }
 
  #avoid php readfile()
  location ^~ /blogs.dir {
    internal;
    alias /var/www/ipkd/htdocs/wp-content/blogs.dir ;
    access_log off;  log_not_found off; expires max;
  }
 
  if (!-e $request_filename) {
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;  
    rewrite ^(/[^/]+)?(/wp-.*) $2 last; 
    rewrite ^(/[^/]+)?(/.*.php) $2 last; 
  }
 
  location / {
    try_files $uri $uri/ /index.php?$args ;
  }
 
  location ~ .php$ {
    try_files $uri =404;
    include fastcgi_params;
    fastcgi_pass php;
  }
 
  #此处可以继续添加伪静态规则
}

<h3wordpress实现多站点二级域名重写规则

map $http_host $blogid {
  default     -999;
 
  #Ref: http://wordpress.org/extend/plugins/nginx-helper/
  #include /var/www/wordpress/wp-content/plugins/nginx-helper/map.conf ;
 
}
 
server {
  server_name ipkd *.ipkd ;
  
  root /var/www/ipkd/htdocs;
  index index.php;
  
  location / {
    try_files $uri $uri/ /index.php?$args ;
  }
  
  location ~ .php$ {
    try_files $uri =404;
    include fastcgi_params;
    fastcgi_pass php;
  }
  
  #WPMU Files
  location ~ ^/files/(.*)$ {
  try_files /wp-content/blogs.dir/$blogid/$uri /wp-includes/ms-files.php?file=$1 ;
  access_log off; log_not_found off;    expires max;
  }
  
  #WPMU x-sendfile to avoid php readfile()
  location ^~ /blogs.dir {
    internal;
    alias /var/www/ipkd/htdocs/wp-content/blogs.dir;
    access_log off;	log_not_found off;	expires max;
  }
  
  #此处可以继续添加伪静态规则
}

Nginx如何快速提高网站响应速度(Nginx Proxy Manager)

Nginx如何设置限流?方法介绍

Nginx是如何实现访问日志的?

Nginx支持哪些常见的HTTP头?(附配置说明)

Nginx如何实现安全性能优化

标签: nginx, rewrite重写, wordpress重写规则

上面是“wordpress如何实现nginx多站重写规则”的全面内容,想了解更多关于 wordpress 内容,请继续关注web建站教程。

当前网址:https://ipkd.cn/webs_3832.html

声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

当前位置: 网站首页 > wordpress
本文共计1610个字,预计阅读时长11分钟
生活小工具,收录了80多款小工具
上一篇: 基于JavaScrip的web动画库——GSAP
下一篇: 免费商用中文字体——优设鲨鱼菲特健康体
x 打工人ai神器