You need to set the path to your .conf file in the plugin general options then let W3 Total write to the file.
I would create a w3-total.conf file in /etc/nginx then chown it www-data:www-data so w3 can write to it then add it as an include in your server file.
Update:
To answer your additional questions. If all your sites are using the same W3 Total Cache settings give them all the same path to the configuration file and include it inside all your server blocks.
For simplification I like to keep all my server blocks in 1 file then include a global wp.conf and a global w3-total.conf.
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.conf:
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.conf
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/*;
}
The above configuration is for a small Debian Squeeze VPS running php-fpm 5.4 and Nginx 1.2.0