小内存VPS优化建议 LNMP+Wordpress环境
#WP Permalinks rewrite
rewrite ^.*/files/(.*)$ /wp-includes/ms-files.php?file=$1 last;
if (!-e $request_filename) {
rewrite ^.+?(/wp-.*) $1 last;
rewrite ^.+?(/.*\.php)$ $1 last;
rewrite ^ /index.php last;
}
#WP-super-cache rewrite
set $wp_super_cache_file ”;
set $wp_super_cache_uri $request_uri;
if ( $request_method = POST )
{
set $wp_super_cache_uri ”;
}
if ( $query_string )
{
set $wp_super_cache_uri ”;
}
if ( $http_cookie ~* “comment_author_|wordpress|wp-postpass_” )
{
set $wp_super_cache_uri ”;
}
if ( $wp_super_cache_uri ~ ^(.+)$ )
{
set $wp_super_cache_file /wp-content/cache/supercache/$http_host/$1index.html;
}
if ( -f $document_root$wp_super_cache_file )
{
rewrite ^(.*)$ $wp_super_cache_file break;
}
if (-f $request_filename)
{
expires 30d;
break;
}
if (!-e $request_filename)
{
rewrite ^(.+)$ /index.php?q=$1 last;
}
|
sudo apt-get install nginx php5 php5-dev php5-fpm php5-mysql mysql-server make |
worker_processes 4; worker_cpu_affinity 0001 0010 0100 1000; |