成人午夜激情影院,小视频免费在线观看,国产精品夜夜嗨,欧美日韩精品一区二区在线播放

nginx下配置wordpress多站點rewrite規則

2013-04-08 20:53:08來源:chinaz作者:

wordpress多站點模式可以被應用在多種方式上。其中最常用的是在"子目錄"模式或者"二級域名"模式上。Nginx提供了兩種特殊的指令:"x-accel-redirect"和"map",使用這兩個指令可以使得wordpress多站點的網絡服務實現偽

wordpress多站點模式可以被應用在多種方式上。其中最常用的是在"子目錄"模式或者"二級域名"模式上。Nginx提供了兩種特殊的指令:"x-accel-redirect"和"map",使用這兩個指令可以使得wordpress多站點的網絡服務實現偽靜態功能。

wordpress多站點模式可以被應用在多種方式上。其中最常用的是在"子目錄"模式或者"二級域名"模式上。Nginx提供了兩種特殊的指令:"x-accel-redirect"和"map",使用這兩個指令可以使得wordpress多站點的網絡服務實現偽靜態功能。

wordpress多站點使用子目錄重寫規則

配置中54ux.com修改為自己的站點域名。

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 54ux.com ;

root /var/www/54ux.com/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/54ux.com/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;

}

#此處可以繼續添加偽靜態規則

}

wordpress多站二級域名重寫規則

配置中54ux.com修改為自己的站點域名。

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 54ux.com *.54ux.com ;

root /var/www/54ux.com/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/54ux.com/htdocs/wp-content/blogs.dir;

access_log off;log_not_found off;expires max;

}

#此處可以繼續添加偽靜態規則

}

備注

"map"部分可以應用于小站點。大站點的多站點應用可以使用 nginx-helper wordpress插件 。

如果想進一步優化wordpress的性能可以使用Nginx的fastcgi_cache,當使用fastcgi_cache配置需要在編譯nginx時加上ngx_cache_purge模塊以及使用wordpress的緩存插件等等。

贊助商鏈接:

主站蜘蛛池模板: 霍林郭勒市| 普兰店市| 郓城县| 岐山县| 高雄县| 南汇区| 闽清县| 临汾市| 崇信县| 长汀县| 赤城县| 凌海市| 宁夏| 蒲城县| 安乡县| 石家庄市| 改则县| 永吉县| 织金县| 子洲县| 探索| 张掖市| 蒙城县| 林西县| 吐鲁番市| 雷山县| 正宁县| 西青区| 习水县| 仙游县| 锡林郭勒盟| 金门县| 延吉市| 西城区| 江孜县| 扬州市| 拉萨市| 深州市| 丰城市| 义马市| 广东省|