Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've won a sweet managed VPS hosting package with Anchor (VPS D), and I'm looking for recommendations on how to set up the server. Anchor will setup apache or nginx for me - but which should I choose?!

My considerations are:

  • I'm concerned that there'll be a big configuration shift between my staging server and the clients' production servers: generally cheap shared hosting
  • I'm hosting my own site here, so I want it fast (anything will be, compared to my old shared hosting!)
  • my site, and my clients' are quiet low traffic sites
  • I'll certainly be caching with WP-Supercache
  • I use rewrites regularly for SEO purposes
  • I'm familiar with .htaccess
  • I won't have root access, but understand that I could edit non-root try files under nginx

I'm leaning towards staying with apache, but want to be sure before passing up the opportunity to implement nginx, which seems superior for higher traffic setups.

This question deals with hosting, but I'm interested in the experience of developers using WordPress in particular (and some business logic), so I believe it belongs here rather than on Serverfault.

I appreciate any thoughts, Cheers, Tim

share|improve this question

closed as off topic by anu, kaiser, Chris_O, Wyck, Brian Fegter Aug 30 '12 at 3:15

Questions on WordPress Development Stack Exchange are expected to relate to WordPress within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
The question is to broad considering it's also about servers. Asking specific things will likely solicit answers –  Wyck Aug 17 '12 at 17:20
add comment

3 Answers

up vote 2 down vote accepted

Anchor will setup apache or nginx for me - but which should I choose?!

Based on your concerns, I'd recommend Nginx -> Apache stack.


Please let me explain. By default, Nginx can only process static content, such as images, CSS and JS files. Nginx passes PHP requests to PHP-FPM or to other servers such as Apache. Nginx can still cache dynamic content via proxy_cache and fastcgi_cache. When people talk about Nginx, they usually mean Nginx -> PHP-FPM stack. Basically, there is nothing wrong with an Nginx -> PHP-FPM stack. But, for your requirements, it's a big no-no.


Please let go through some of your considerations...

I'm hosting my own site here, so I want it fast

Apache is already the fastest server that I know of. It just needs right configuration to make it efficient. Unfortunately, not every host is willing to tune it to their individual customer's requirement. It is not practical either to do so, when we consider the time to tweak an Apache server, than setting up an Nginx server (with PHP-FPM). The problems arises in Apache, only when there is a traffic spike (I mean concurrent connections).

my site, and my clients' are quiet low traffic sites

The visitors wouldn't notice any difference in performance, if the traffic is low. I recommend Nginx for high traffic environments where there is probability of C10K problem.

I'll certainly be caching with WP-Supercache

Unlike W3 Total Cache plugin, WP-Supercache doesn't work right out of the box with Nginx (with PHP-FPM), even though there is a great codex entry on how to integrate.

I use rewrites regularly for SEO purposes

It means that you must learn rewrites in Nginx or your host should be able to write the rewrites for you. Rewrites are easy in Nginx, once mastered. But there is a learning curve involved in it. Apache and Nginx work bit differently when it comes to rewrites.

I won't have root access, but understand that I could edit non-root try files under nginx

The rewrites and how Nginx (with or without PHP-FPM) parses rewrites are bit different than the traditional Apache setup. For example, we can modify anything in .htaccess file and Apache picks it up on the fly. But, Nginx still needs to be reloaded (or restarted) for every change in the Nginx configuration. It doesn't matter if you change a try_files or a rewrite directive. So, you may still need the root privilege or you may have to ask your host to reload (restart) Nginx server on every change in the Nginx configuration. BTW, Nginx doesn't process .htaccess files.

Conclusion

An Nginx -> Apache stack can solve all the concerns mentioned above. It works right out of the box with WP-SuperCache and it processes .htaccess file on the fly. There is no need to learn Nginx rewrites too.

share|improve this answer
    
I really like the detail here ... But I think you end up suggesting a 'Ferrari' for a low volume low usage site. However Im off to look up an nginx->apache stack to setup. –  Damien Jul 27 '12 at 17:21
    
:) Usually, this stack is done by letting Nginx to listen on port 80 and Apache on another port. You (or your webhost) can still remove Nginx safely, if this stack doesn't work for some reason. Also, when something doesn't work, it is possible to test Apache alone using its own port. –  Pothi Jul 28 '12 at 1:16
    
Great reply! This sounds like it would be the best approach for me if performance was a higher priority than ease of use :) After my reading, and the answers I've had here and elsewhere, I reckon I'll stick with a straight Apache setup, and learn to optimise that.. Many thanks! –  memeLab Jul 29 '12 at 7:40
add comment

The Hosting Wordpress article can help you choosing.

This question might also help you.

share|improve this answer
    
thanks for the links! –  memeLab Jul 27 '12 at 5:17
add comment

NGINX has a lot of appeal and potentially could have some benefit professionally (though I don't know what you do).

That said, with NGINX you will definitely have a harder time with maintaining WordPress, due to plugin conflicts, caching and even permalinks not working.

If you're up for that ... then go for NGINX. You could even blog about it and help add to the knowledge base.

Otherwise stick with a LAMP stack and not a LNMP stack

share|improve this answer
    
yup, all the feedback suggests more work using nginx (this would be fine if I were paid for high performance!) –  memeLab Jul 27 '12 at 5:18
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.