Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: nginx, apache & cdn's
PostPosted: Thu Oct 18, 2012 3:44 pm 
Offline
Senior Newbie

Joined: Thu Oct 04, 2012 4:09 pm
Posts: 12
Hello,

I am currently setting up a codeigniter & wordpress application using apache. I am now finding out more about nginx and the power it has.

I am planning to use a CDN (Amazon or Rackspace) for handling my images, videos, css, javascript. In this case, would I still see a performance boost from using nginx (reverse proxying to apache)?

The other option is using nginx as the sole webserver and remove apache completely. I do have some complex .htaccess rules, so not sure if it will all translate, but if I pursue this route, would i still see a performance improvement?

so the options are:

a) nginx + apache + cdn
b) apache + cdn
c) nginx + cdn

Thanks!


Top
   
PostPosted: Thu Oct 18, 2012 5:52 pm 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
I see little benefit to mixing and matching multiple webservers simultaneously. nginx or apache, pick one and stick with it.


Top
   
PostPosted: Fri Oct 19, 2012 12:08 am 
Offline
Senior Member
User avatar

Joined: Sun Jan 18, 2009 2:41 pm
Posts: 830
If your Linode is only going to serve dynamic content, then there's not much point in a reverse proxy. Perhaps you might see some performance difference between Apache and nginx but since each request still needs a PHP interpreter instance to run on, it seems like this would be minimal.


Top
   
PostPosted: Fri Oct 19, 2012 5:04 pm 
Offline
Senior Newbie

Joined: Thu Oct 04, 2012 4:09 pm
Posts: 12
Thanks for the advice. I will look into using Nginx as my sole web server and see if i can massage the current .htaccess files into it.

One interesting thing I found in my research is that if I can cache the whole page, then I can have that displayed before needing to involve the php interpreter. I can do this because I have an ecommerce site and most of my pages are not changing much and are not personalized.

The 3 ways of doing that are:

a) Use varnish in front of nginx / apache to serve the entire cached pages

b) Use nginx's cache module to cache the pages.

c) Use nginx as the web server along with memcached integration. This way, my codeigniter application would add the page to memcached and then nginx would deliver that page if it exists in memcached. further details are here: http://technosophos.com/content/53900-s ... e-way-down

Option b and c seem the most interesting, and leaning toward option c I think.


Top
   
PostPosted: Fri Oct 19, 2012 5:13 pm 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
Just keep in mind that Varnish is designed/intended to sit on its own dedicated box, using a very large swap file/partition as disk cache.


Top
   
PostPosted: Fri Oct 19, 2012 5:37 pm 
Offline
Senior Newbie

Joined: Thu Oct 04, 2012 4:09 pm
Posts: 12
thanks for the advice on varnish. if i go the nginx + memcached route, where would you recommend i put memcached?

i currently am configuring 3 linodes:

- a web server (512 MB)
- master database server (1GB)
- slave database server (512 GB).

should i place memcached on the web server and increase the memory or place it on the slave database server as it will probably have the lowest usage of the 3 linodes.

thanks.


Top
   
PostPosted: Thu Oct 25, 2012 10:12 pm 
Offline
Senior Member

Joined: Thu Oct 08, 2009 5:07 pm
Posts: 99
From experience, I'd recommending using nginx on its own with PHP-FPM, and not nginx->apache. Converting the rewrites isn't too difficult, and there are decent convertors to help you along (although they are not 100% accurate but will help).

I also recommend using nginx's cache to cache your Wordpress pages. There is a Wordpress plugin that sends appropriate headers to nginx. I got something crazy like 9000 requests/second from a small Linode using this. I wouldn't bother using memcached for this.


Top
   
PostPosted: Wed Oct 31, 2012 2:23 pm 
Offline
Senior Newbie

Joined: Thu Oct 04, 2012 4:09 pm
Posts: 12
thanks, i was able to get nginx configured with my previous .htaccess rules and don't need to use apache anymore. i actually like nginx's syntax and found it just as easy if not easier than apache.

i will look into the nginx cache further as well. who knew that there was so much performance improvement over lamp which i've been using over the past 5 years.


Top
   
PostPosted: Wed Oct 31, 2012 2:28 pm 
Offline
Senior Member

Joined: Thu Oct 08, 2009 5:07 pm
Posts: 99
If you are using PHP-FPM which you likely will, pay attention to the various tuning settings there including emergency restarting.


Top
   
PostPosted: Wed Oct 31, 2012 2:34 pm 
Offline
Senior Newbie

Joined: Thu Oct 04, 2012 4:09 pm
Posts: 12
ok, thanks, i will look into that. can monit be configured for php-fpm as well? i have that configured to watch nginx.


Top
   
PostPosted: Wed Oct 31, 2012 2:42 pm 
Offline
Senior Member

Joined: Thu Oct 08, 2009 5:07 pm
Posts: 99
I don't know about monit, but I do use munin with it.


Top
   
PostPosted: Wed Oct 31, 2012 2:44 pm 
Offline
Senior Newbie

Joined: Thu Oct 04, 2012 4:09 pm
Posts: 12
nevermind, i found the pid in the php-fpm.conf file and i can use that to add it in monit. i will add the settings in fpm as well


Top
   
PostPosted: Wed Oct 31, 2012 2:49 pm 
Offline
Senior Member

Joined: Thu Oct 08, 2009 5:07 pm
Posts: 99
I should look into monit one day


Top
   
PostPosted: Wed Oct 31, 2012 3:00 pm 
Offline
Senior Newbie

Joined: Thu Oct 04, 2012 4:09 pm
Posts: 12
yeah, it's pretty nice. here's an example from a linode user to get started with an example configuration.

viewtopic.php?t=6942

you can install it through the package manager to get started.


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


Who is online

Users browsing this forum: No registered users and 3 guests


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