Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Raspberry web server: Apache or nginx ?
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.

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

  • MikeAMikeA Member, Patron Provider

    Nginx. Lower resource usage, you're on a Rasberry.

    Thanked by 1MrH
  • +1 for Nginx.

    Thanked by 1MrH
  • Jona4sJona4s Member
    edited June 2018

    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.

    Thanked by 1MrH
  • I get it, it uses way less RAM (I have XAMPP on Windows and it's a RAM hog)

  • raindog308raindog308 Administrator, Veteran

    dergelbe said: 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.

    Jona4s said: Have you consider a compiled language, like Golang or C for example?

    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.

    Thanked by 1MrH
  • 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.

  • riotriot Member
    edited June 2018

    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

  • graphicgraphic Member
    edited June 2018

    @dergelbe Caddy

    Edit: Caddy is extremely lightweight and ez to use.

    Thanked by 1GoatSeller
  • 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/

    Thanked by 1rm_
  • raindog308raindog308 Administrator, Veteran

    Ole_Juul said: 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 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.

  • @raindog308 said:

    Ole_Juul said: 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 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.

  • PUSHR_VictorPUSHR_Victor Member, Host Rep
    edited June 2018

    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

  • mkshmksh Member

    @raindog308 said:

    Ole_Juul said: 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 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.

    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.

  • @raindog308 said:
    I think nginx's benefits really only come into play when you have many simultaneous visitors.

    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.

  • lurchlurch Member
    edited June 2018

    I run diet pi on a pi 3 and it's works fine for low volume website

  • sinsin Member

    What about Hiawatha webserver?

    Thanked by 1niknar1900
  • dergelbe said: I think you still benefit from lower RAM use.

    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.

  • @Ole_Juul said:

    dergelbe said: I think you still benefit from lower RAM use.

    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 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.

  • defaultdefault Veteran

    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.

Sign In or Register to comment.