networking, nextcloudpi

Why NextCloudPi uses Apache and not Nginx

Many people seem surprised that NextCloudPi uses Apache and not Nginx. I will briefly explain my rationale here so I can just refer those people to this post.

Said people insist that Nginx is much more performant, specially on a limited SBC such as the Raspberry Pi.

First, let’s read a comparison. There are many other similar posts out there

From benchmarks like this one, we can observe that

  • It is true that Nginx is faster at delivering static pages
  • It is also true that it better handles high concurrent loads. Actually, this is where it shines.
  • They are equivalent when it comes to delivering dynamic pages.

When you are self hosting Nextcloud on your Raspberry Pi for personal use, you are in none of the first two cases.

There will be a single user, or maybe just a bunch of users. This means that there will be low concurrency. Also, note that NextCloud is a completely dynamic web service based on PHP.

This means that for a personal hosting only accessed by you you won’t feel a difference. Additionally, Apache has gradually incorporated the multithreading design through its MPM module. At this point, it makes the difference even smaller, even though there remains a lot of outdated websites making it look worse than it is.

From the maintainer perspective though, Apache is easier:

It has many modules, and they can be loaded dynamically, meaning that is easy to install them from apt.

Nginx is only starting to do this and is still not easy to accomplish. In general, you have to compile your modules. It also has less options to choose from, even though the important ones are there for both.

If you read this post about NextCloud security and this other post about Apache modsecurity, you will hopefully understand why I really value the added security of modsecurity for Apache. You personal cloud holds your most private data and I feel that there is not enough security that you can put in place. It is not your personal blog, its your personal cloud where you sync pictures, personal documents and the like.

Modsecurity started off as an Apache module, even though it has now been ported to Nginx, it requires to be compiled and is not as readily available as the Apache Module.

Hopefully you can now see why I see little added benefit in going through the extra effort of using Nginx and making it work with Modsecurity. My time is limited and I think is better utilized in providing more features, stability and fixing bugs.

Of course people are welcome to setup their cloud their way for their own reasons.

All of NextCloudPi source code is open, and contributions are welcome. If anybody is up for the task and still feel strongly about using Nginx, or a different DDNS provider or anything else, just talk to me, send me a pull request and contribute to NextCloudPi.

The more people working on this the better!

Author: nachoparker

Humbly sharing things that I find useful [ github dockerhub ]


  1. Thank you so much for this post! I have been trying for a while to set up a nextcloud server with a combo of nginx/php7/mariadb and apache was the reason I did not use your resources and followed your steps. I really wanted top performance because my first attempt on a Pi 1 with apache/php5/sqlite was sooo slow… Reading this post though, my search is over 🙂

  2. Thanks for the clarifications. I was thinking of using nginx for Nextcloud@pi, but now i see i don’t need to.

    How about lighttpd instead? Would lighttpd be better for the limited-resource Pi compared to Apache?

  3. Speaking specifically about security, when so many recommendations are made about ‘nextcloud plus reverse proxy handling https’, from reading your article can I assume that nextcloudpi with Apache modsecurity in a DMZ is just as secure as nextcloud behind a reverse proxy?

Leave a Reply

Your email address will not be published. Required fields are marked *