Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Mon Oct 10, 2011 3:51 pm 
Offline
Senior Member

Joined: Wed Dec 01, 2010 10:39 am
Posts: 71
Website: http://www.pannix.net
Location: Belgium
You can use variables in config files to make life easier like :
- rewrite ^ http://www.example.com$request_uri permanent;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

But how do you use a variable with an include statement.

When you use Wordpress on Nginx with the W3 Total Cache plugin you need to include the nginx.conf file in the document root:
Code:
include /srv/www/example.com/public_html/nginx.conf

Basically you could create one config file for wordpress and include it in the config files in sites-available/ for all your wordpress sites. The one thing I haven't figured out is how to pass a variable to an include statement. The following statements don't work:
- include $document_root.'nginx.conf'
- include $document_root$wpnginx_conf (where $wpnginx_conf = nginx.conf)

One of the error messages I got is that it couldn't find the file /etc/nginx/$document_root$wpnginx_conf.

So, how can I solve this? Or is there a way around this? Or is this the one statement that I will have to put in the conf files for every wordpress site?


Top
   
 Post subject:
PostPosted: Mon Oct 10, 2011 3:58 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
AFAIK you cannot use variables in nginx config file includes. This is because includes are processed before any variables are evaluated.


Top
   
 Post subject:
PostPosted: Mon Oct 10, 2011 4:13 pm 
Offline
Senior Member

Joined: Sun Mar 28, 2010 2:43 pm
Posts: 76
Website: http://tomakefast.com
Location: Texas
Google this bit of NginX awesomeness and you should find some good nginX.conf examples:

if (!-e $request_filename) {
rewrite ^.+/?(/wp-.*) $1 last;
rewrite ^.+/?(/.*\.php)$ $1 last;
rewrite ^(.+)$ /index.php?q=$1 last;
}

I'm hosting about a dozen WordPress blogs and my NginX.conf doesn't have any includes or anything specific to WordPress besides those rewrites I just posted. My nginx.conf is 125 lines with comments. IMO, no need to make something so simple more complex by breaking it into pieces.

That said, unless you're a top-tier blog (ranked in the top 10,000 domains) I bet you don't even need this cache plugin because WordPress has its own cache and Linode+NginX is pretty darn fast.

_________________
PHP Development @ Tomakefast


Top
   
 Post subject:
PostPosted: Mon Oct 10, 2011 4:45 pm 
Offline
Senior Member

Joined: Sun Mar 28, 2010 2:43 pm
Posts: 76
Website: http://tomakefast.com
Location: Texas
For example, petsmartfeedback.com is ranked around 10,000 in Quantcast and they have only about 200,000 visits/month. Are you in the top 10k?

If that petsmartfeedback site ran WordPress with a few plugins, Linode plus NginX, I bet the CPU would be easily under 50% all day long with no cache plugin. I think you will run out of bandwidth before you run out of Linode CPU power running WordPress on the Linode 512.

Not trying to belittle your site, but I hope you really need that plugin before you go tearing your hair out like I see a lot of people doing with WordPress. You did the right thing moving to Linode + Nginx ;-) I'm just guessing but now I think you can relax about speed. If you're new to Linode--just see what your new Linode can do without this cache plugin, you should be pleasantly surprised.

In my experience, if a site is slow after moving to Linode, there's probably a serious flaw somewhere and the cache plugin only makes that harder to pinpoint and correct--the slowness is still there, but now only intermittently when the cache is reset.

Before installing a WordPress cache plugin I would try a simpler, more elegant solution--check your my.cnf settings. Install "mysqltuner" and follow the recommendations. Your experience may be different, but when I install MySQL with Fedora, by default the caching is not the best and you can see a huge improvement with very small my.cnf adjustments.

_________________
PHP Development @ Tomakefast


Top
   
 Post subject:
PostPosted: Tue Oct 11, 2011 4:13 am 
Offline
Senior Member

Joined: Wed Dec 01, 2010 10:39 am
Posts: 71
Website: http://www.pannix.net
Location: Belgium
200,000 visits/month! Not yet, not even close :lol:
W3TC plugin has its uses. When I first started blogging and adding plugins the page load time increased to 8 seconds. I managed to get it under 2 seconds by removing plugins, replacing some other plugins, and following advice given by YSlow. I just installed W3TC (still on shared hosting) and page load times (using http://whichloadsfaster.com/) decreased by 30%. That alone justifies using it. Moving to my Linode and some more tweaking might reduce it even further (to less than a second?).

Will have a look at mysqltuner. Thanx for the tip.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group