Salut Internaute!
Tout petit billet pour te donner la configuration Nginx que j’utilise désormais sur mes WordPress 3 en mode « multi-blog » avec php-fpm.
Il s’agit donc de la conf du vhost du WordPress en question:
server{
server_name *.example.com;
listen 80;
#on server block
##necessary if using a multi-site plugin
server_name_in_redirect off;
##necessary if running Nginx behind a reverse-proxy
port_in_redirect off;
access_log /var/log/nginx/example.com-access.log;
location / {
root /var/www/example.com/wordpress;
index index.html index.htm index.php;
# if the requested file exists, return it immediately
if (-f $request_filename) {
break;
}
## W3 Total CACHE BEGIN
set $totalcache_file '';
set $totalcache_uri $request_uri;
if ($request_method = POST) {
set $totalcache_uri '';
}
# Using pretty permalinks, so bypass the cache for any query string
if ($query_string) {
set $totalcache_uri '';
}
if ($http_cookie ~* "comment_author_|wordpress|wp-postpass_" ) {
set $totalcache_uri '';
}
# if we haven't bypassed the cache, specify our totalcache file
if ($totalcache_uri ~ ^(.+)$) {
set $totalcache_file /wp-content/w3tc-$http_host/pgcache/$1/_index.html;
}
# only rewrite to the totalcache file if it actually exists
if (-f $document_root$totalcache_file) {
rewrite ^(.*)$ $totalcache_file break;
}
##W3 Total CACHE END
# all other requests go to WordPress
if (!-e $request_filename) {
rewrite . /index.php last;
}
}
## Images and static content is treated different
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
access_log off;
expires 30d;
root /var/www/example.com/wordpress;
}
location ~ wp\-.*\.php|wp\-admin|\.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/example.com/wordpress$fastcgi_script_name;
}
}
Aller salut!!