0

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

1
  • The question is to broad considering it's also about servers. Asking specific things will likely solicit answers
    – Wyck
    Commented Aug 17, 2012 at 17:20

3 Answers 3

2

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.

3
  • 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
    Commented Jul 27, 2012 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. Commented Jul 28, 2012 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!
    – ptim
    Commented Jul 29, 2012 at 7:40
1

The Hosting Wordpress article can help you choosing.

This question might also help you.

0
1

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

1
  • yup, all the feedback suggests more work using nginx (this would be fine if I were paid for high performance!)
    – ptim
    Commented Jul 27, 2012 at 5:18

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