您需要设置到的路径。插件常规选项中的conf文件,然后让W3 Total写入该文件。
我将创建一个w3总计。etc/nginx中的conf文件,然后下载它的www-data:www-data,以便w3可以写入它,然后将其作为include添加到服务器文件中。
更新:
以回答您的其他问题。如果所有站点都使用相同的W3 Total缓存设置,则为它们提供相同的配置文件路径,并将其包含在所有服务器块中。
为了简化,我喜欢将所有服务器块保存在一个文件中,然后包含一个全局wp。conf和全球w3总计。形态。
server {
listen 80;
server_name domain1.com www.domain1.com;
root /srv/www/domain1;
index index.php index.html index.htm;
include w3-total.conf;
include wp.conf;
}
server {
listen 80;
server_name domain2.com www.domain2.com;
root /srv/www/domain2;
index index.php index.html index.htm;
include w3-total.conf;
include wp.conf;
}
wp。形态:
error_page 404 = @wordpress;
log_not_found off;
location / {
try_files $uri $uri/ /index.php?$args;
}
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
location @wordpress {
fastcgi_pass php;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
include fastcgi_params;
fastcgi_param SCRIPT_NAME /index.php;
}
location ~ \\.php$ {
fastcgi_max_temp_file_size 1M;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_index index.php;
fastcgi_pass php; // php is defined in nginx.conf
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
try_files $uri @wordpress;
}
Nginx。形态
user www-data;
worker_processes 8;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
sendfile on;
keepalive_timeout 3;
client_max_body_size 13m;
# Upstream to abstract backend connection(s) for PHP.
upstream php {
server unix:/var/run/php5-fpm.sock; //Make sure your setup to use sockets in /etc/php5/fpm/pool.d/www.conf
}
include sites-enabled/*;
}
以上配置是针对运行php fpm 5.4和Nginx 1.2.0的小型Debian挤压VPS的