Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Wordpress is quite a memory hog, and I've been thinking of using nginx rather than apache.

The one major consideration before doing that is if there are any plugins which will stop working. I have tested a few and they seem to work, but I need to find out if there are any which might break.

share|improve this question
2  
"...nginx rather than wordpress." Perhaps you mean "nginx rather than Apache"? – Grant Palin Aug 13 '10 at 17:26
Thanks Grant. Edited. – Sudhanshu Raheja Aug 13 '10 at 23:26

6 Answers

up vote 3 down vote accepted

I unfortnately have no experience with this but evidently it can be done as these articles and plugins address some of the issues:

Also are you familiar with WP Engine WordPress hosting? They are evidently using it in a hybrid form with Apache, probably as a front-end proxy.

Hope these help.

share|improve this answer
Thanks for the links Mike. I've tried a number of plugins with it and it seems to work great! – Sudhanshu Raheja Aug 16 '10 at 12:38

Small world :). You won't see a lot of issues with Nginx and Apache + Wordpress. We use it for our company as well, and we have no problem getting one server to serve 200k uniques/month and over a million pageviews/month for one site. Nginx + W3 Total Cache, you get some very remarkable numbers.

share|improve this answer
Yeah :) Thanks for the update. I've been trying it out myself and looks quite solid! – Sudhanshu Raheja Aug 16 '10 at 12:41

The biggest difference is rewrite rules, but there are plenty of guides out there (such as the ones Mike linked) that provide you with equivalent rewrite rules.

From a plugin perspective, unless the plugin is doing something really crazy, then it shouldn't know the difference. All internal rewrite rules and that sorta stuff is handled at the WordPress level, independently of your HTTPD.

In short, go for it.

share|improve this answer
Thanks Viper. I got a lot of samples of nginx rules to replace the ones for apache. Besides, have been trying writing Nginx's rules myself, and it seems pretty straight forward. So this shouldn't be an issue anymore. – Sudhanshu Raheja Aug 16 '10 at 12:39

Using Nginx will not make wordpress use less memory. If you're concerned about memory, you can save some server-wise by optimizing your apache configuration to only load the modules you need and do other configuration that will reduce the memory apache needs.

Next to that, apache has caching modules as well worth to consider, so to save all memory wordpress would have used when invoked. Since wordpress output get's cached, wordpress does not need to run any longer and you save the memory.

share|improve this answer

When WordPress detects that mod_rewrite is not loaded it falls back to pathinfo ie:(/index.php/%postname%/) permalinks in Permalink Settings page. You can use the nginx Compatibilityplugin to force WordPress to use pretty permalinks then add rewrite rules to your nginx server file:

server { server_name mysite.com;

root /path/to/blog;

index index.php;

location / {
    try_files $uri $uri/ @wordpress;
}

location @wordpress {
    fastcgi_pass ...;
    fastcgi_param SCRIPT_FILENAME $document_root/index.php;
    include /etc/nginx/fastcgi_params;
    fastcgi_param SCRIPT_NAME /index.php;
}

location ~ \.php$ {
    try_files $uri @wordpress;
    fastcgi_index index.php;
    fastcgi_pass ...;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include /etc/nginx/fastcgi_params;
}

}
share|improve this answer

The docs are written in Russian and somewhat vague. Sometimes you're wondering if the translation is bad or if the docs are just not very explicit in the first place. So finding answers is sometimes time-consuming and/or requires trial-and-error testing.

However, the author seems very engaged with the community, explaining configuration options. And NginX itself gives you some feedback, such as "you can't use this option here."

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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