Nginx - Making stats accessible when using wordpress

Wordpress & Dreamhost Site Statistics on Apache:

Please remember that your "standard" WordPress .htaccess file for Apache will look something like this:

 RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule. /index.php [L] 
 * 1) BEGIN WordPress
 * 1) END WordPress

To allow the "stats" directory to be displayed properly on Dreamhost web panel, you'll need to add the following lines to your .htaccess file before any other rules will be added:

 RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^/(stats|failed_auth\.html).*$ [NC] RewriteRule. - [L] 

What to change when you've decided running Wordpress under Nginx on your VPS:

When using Nginx & you want to get the Dreamhost analog Site Statistics area working again, you must add the following rule at the very beginning of your wordpress.conf files:

if ($request_uri ~* ^/(stats|failed_auth\.html).*$) { 	break; }
 * 1) stats

To get Wordpress AND the Dreamhost analog Site Statistics working properly with Nginx, please try to use the following rules at your wordpress.conf file (/home/YOURUSER/nginx/example.com/wordpress.conf):

if ($request_uri ~* ^/(stats|doc|failed_auth\.html).*$) { 	break; } if (!-e $request_filename) { rewrite ^.*$ /index.php last; }
 * 1) stats
 * 1) Permalinks

WP SuperCache:

With WP SuperCache you might want to put the four lines above right before the permalinks section. The following lines are just a snippet from a whole wordpress.conf file!

### if (-f $document_root$supercache_file) { rewrite ^(.*)$ $supercache_file break; } if ($request_uri ~* ^/(stats|doc|failed_auth\.html).*$) { break; } if (!-e $request_filename) { rewrite ^.*$ /index.php last; }
 * 1) rest of wordpress.conf above...
 * 1) only rewrite to the supercache file if it actually exists
 * 1) stats
 * 1) all other requests go to Wordpress

Attention:

If your Site Statistics area will be accessible but insn't updating, please contact the DH support to re-configure your stats - that's all.

For more information about Nginx and Wordpress, please go to http://wiki.dreamhost.com/Nginx!