New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Raspberry web server: Apache or nginx ?
I am thinking of setting up a Raspberry web server on /localhost/ and wonder if nginx brings much advantage.
I just need a DB (probably MariaDB rather than MySQL), and a few PHP pages. No CMS, no WP.
I want to use it as storage for PDF files. The PDF text is parsed from the (I make them readable) PDF and stored in the DB. I can then search the DB to find certain PDF rather than the PDF itself (probably slow). PDF can be d/l or read in the browser.
I do have a NAS with a web server function too, but that is rather slow.
Apache or nginx? Other suggestions are welcome too!
Comments
Nginx. Lower resource usage, you're on a Rasberry.
+1 for Nginx.
Have you consider a compiled language, like Golang or C for example?
There are frameworks such as FastHTTP with the equivalent features of Nginx+PHP, giving you the extra performance you might need.
I get it, it uses way less RAM (I have XAMPP on Windows and it's a RAM hog)
If you want to use less ram, perhaps use sqlite instead of MySQL. I don't recall offhand what sqlite's full text search capabilities are compared to Maria.
Golang is very simple in these situations. Web server is built in, sqlite is easy, good support for http, etc. I'm biased as it's my current technical infatuation. You could of course use other languages but if you go php, I would go with nginx + php-fpm. I run that on my pi for a home digital photo frame kind of app and it works well.
Nothing fancy. Pages are simple PHP and HTML. Maybe some JS/Jquery. The actual PDF processing, changing PDF version, getting the OCR etc. I do on another PC.
Do you already have the r-pi? For around the same money you have other, more powerful options.
https://www.hardkernel.com/main/main.php
https://www.pine64.org/?product=rock64-media-board-computer
etc etc
@dergelbe Caddy
Edit: Caddy is extremely lightweight and ez to use.
I don't doubt what people are saying about nginx and etc., but just for perspective's sake, want to say that I have a fairly well frequented web site running on the original RPi (256Mb RAM 700MHz CPU) and I'm using Apache2. I don't see any problems.
I would recommend checking this one out as it basically runs on anything:
https://www.lighttpd.net/
I think nginx's benefits really only come into play when you have many simultaneous visitors. If it's just one or two people loading a page at any given time, I think you're right that apache is likely fine.
Agree with this wholeheartedly.
Can you cache the results? If yes, Nginx’s fast-cgi cache or Varnish working directly from RAM, and then the setup behind the caching proxy no longer matters. Given the RPI’s limited disk I/O I’d go with Varnish
Agreed. Outside of very high usage it'll probably be hard to tell the difference. For me it comes down to liking Nginx's config way more than Apache's.
It's just me. But I think you still benefit from lower RAM use.
Try dietpi. It’s very light weight and easy to use with the cli configuration.
I run diet pi on a pi 3 and it's works fine for low volume website
What about Hiawatha webserver?
I'm curious about that. It makes sense, but surely it's not something you'd normally detect. I'd like more information about it.
I would go with Nginx + PHP-FPM if I need to run PHP application on Raspberry Pi. I use them for my digital signage project, along with Diet Pi.
I didn't check for that specifically, but I do run XAMPP with Apache on Windows and it certainly needs lots of memory. At one stage I had WT-NMP for Windows and it uses far less RAM. I can't recall why I didn't kept that. I think new PC with 16Gb RAM, so it doesn't really matter anymore compare to the Xp with 4 Gb.
I tested LEMP on a Raspberry Pi Zero W. Therefore I recommend this for Raspberry Pi 3 B+ too, but it all depends on what you feel comfortable with.