Howdy, Stranger!

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


Which is the better web server stack: Nginx or Apache?
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.

Which is the better web server stack: Nginx or Apache?

ProxecureProxecure Member
edited August 2021 in Tutorials

I have multiple static and dynamic websites including WordPress, which server is best suited for me ? Currently I am using apache but I heard that for high volume traffic Nginx Is best. Or should I use nginx as a reverse proxy server ? I mean front of Apache

«1

Comments

  • yoursunnyyoursunny Member, IPv6 Advocate

    I'm using Caddy HTTP server at the front because it offers the easiest TLS configuration including automatically obtaining certificates.
    Some of my sites have nginx behind Caddy, so that I can have server-side FastCGI caching.

    Thanked by 2vyas11 ariq01
  • @yoursunny said:
    I'm using Caddy HTTP server at the front because it offers the easiest TLS configuration including automatically obtaining certificates.
    Some of my sites have nginx behind Caddy, so that I can have server-side FastCGI caching.

    So caddy offer full functionality? Or need to configure it manually

  • @Proxecure said:

    @yoursunny said:
    I'm using Caddy HTTP server at the front because it offers the easiest TLS configuration including automatically obtaining certificates.
    Some of my sites have nginx behind Caddy, so that I can have server-side FastCGI caching.

    So caddy offer full functionality? Or need to configure it manually

    This is just plain software, not a control panel which automated things for you.

    I don't notice much difference in speed or resource consumption between apache and nginx when using php too. The webserver isn't really the bottleneck with php and apache's rewrite are much more comfortable with .htaccess than nginx vhost-config. I use nginx on the download server but I suppose this isn't your use case when you've WordPress installed.

    Thanked by 1Kassem
  • yoursunnyyoursunny Member, IPv6 Advocate
    edited August 2021

    @Proxecure said:

    @yoursunny said:
    I'm using Caddy HTTP server at the front because it offers the easiest TLS configuration including automatically obtaining certificates.
    Some of my sites have nginx behind Caddy, so that I can have server-side FastCGI caching.

    So caddy offer full functionality? Or need to configure it manually

    A sample Caddyfile for a simple PHP site:

    https://www.example.org {
      root * /home/web/example/www
      php_fastcgi unix//run/php/php8.0-fpm.sock
      file_server /static/*
    
      header {
        Strict-Transport-Security max-age=2592000
        X-Frame-Options SAMEORIGIN
        X-Content-Type-Options nosniff
        Referrer-Policy no-referrer-when-downgrade
      }
    
      log {
        output file /var/log/caddy/example.log {
          roll_size 32MiB
          roll_keep 5
        }
        format json
      }
    }
    

    TLS is entirely automatic: just put https:// in front of the domain name.
    HSTS and other security headers need manual configuration, as shown in header directive.

    The structure of this app is (1) index.php handles all dynamic requests (2) /static/ folder contains static assets.
    This is expressed in root php_fastcgi file_server directives.
    More complex rewrite rules are supported too.

  • Not sure if you are already aware of these options:
    https://wordops.net/ (EasyEngine w/o Docker) (free)
    https://centminmod.com/ (free)
    https://runcloud.io/ (paid)

    @yoursunny Automatic TLS is not really compelling to drop using Apache and NGINX especially when Certbot works great now. In Ubuntu you don't even need to setup a cron job for renewal anymore.

    Thanked by 2vyas11 vedran
  • @Proxecure said:
    I have multiple static and dynamic websites including WordPress, which server is best suited for me ? Currently I am using apache but I heard that for high volume traffic Nginx Is best. Or should I use nginx as a reverse proxy server ? I mean front of Apache

    if you can do +nginx

  • @pedagang said:

    @Proxecure said:
    I have multiple static and dynamic websites including WordPress, which server is best suited for me ? Currently I am using apache but I heard that for high volume traffic Nginx Is best. Or should I use nginx as a reverse proxy server ? I mean front of Apache

    if you can do +nginx

    You mean Ngnux Plus ?

  • AXYZEAXYZE Member
    edited August 2021

    @Proxecure said:
    I have multiple static and dynamic websites including WordPress, which server is best suited for me ? Currently I am using apache but I heard that for high volume traffic Nginx Is best. Or should I use nginx as a reverse proxy server ? I mean front of Apache

    For Wordpress go with Nginx + FastCGI + cache on tempfs or OpenLitespeed + LSCache plugin.

    Or use Centminmod and everything will be optimised perfectly. Good security practices, working cache, auto ssl certs, brotli support etc.

  • I'm using Nginx. It is fast and has low memory footprint. There is also a plugin of certbot that automatically creates and renew letsencrypt (Certbot-Nginx)

  • @AXYZE said:

    @Proxecure said:
    I have multiple static and dynamic websites including WordPress, which server is best suited for me ? Currently I am using apache but I heard that for high volume traffic Nginx Is best. Or should I use nginx as a reverse proxy server ? I mean front of Apache

    For Wordpress go with Nginx + FastCGI + cache on tempfs or OpenLitespeed + LSCache plugin.

    Or use Centminmod and everything will be optimised perfectly. Good security practices, working cache, auto ssl certs, brotli support etc.

    I use virtualmin, so Nginx +FastCGI +Cache on tempfs is better? Or should I opt for Openlitespeed?

  • @Proxecure said:

    @AXYZE said:

    @Proxecure said:
    I have multiple static and dynamic websites including WordPress, which server is best suited for me ? Currently I am using apache but I heard that for high volume traffic Nginx Is best. Or should I use nginx as a reverse proxy server ? I mean front of Apache

    For Wordpress go with Nginx + FastCGI + cache on tempfs or OpenLitespeed + LSCache plugin.

    Or use Centminmod and everything will be optimised perfectly. Good security practices, working cache, auto ssl certs, brotli support etc.

    I use virtualmin, so Nginx +FastCGI +Cache on tempfs is better? Or should I opt for Openlitespeed?

    Theyre on top. You cant really say which is better. Try both

  • nemnem Member, Host Rep

    If you want self-renewing SSL, Apache ships with mod_md as well. From what I've squeezed out, NGINX is faster all things being equal (no per-request .htaccess parsing, all configuration existing solely at startup). It's a matter of microseconds, which unless you're pushing significant static file throughput won't make a difference.

    If I were building a CDN, then I'd select NGINX (or maybe h2o). If I were building a server I concerned myself with total security, then I'd pick whatever stack I'm most comfortable with and makes the most sense to me and optimize downstream for bigger problems.

  • I am running PHP so apache is prefered. I don't like php_fcgi.

  • pedagangpedagang Member
    edited August 2021

    @team_traitor said:
    I'm using Nginx. It is fast and has low memory footprint. There is also a plugin of certbot that automatically creates and renew letsencrypt (Certbot-Nginx)

    cpu usage
    whether cpu saving in nginx ????

    i know apache is ram wasteful, ... but ram is cheap

    i am on varnish + apache + memcached and other cache

  • dergelbedergelbe Member
    edited August 2021

    @Kassem said:
    https://wordops.net/ (EasyEngine w/o Docker) (free)
    https://centminmod.com/ (free)
    https://runcloud.io/ (paid)

    Wordops uses nginx (cmm also). Wordops is easy to setup and runs well. This said, it looks a bit like development stopped in 2020 and no updates for a while. I am no Centminmod user, but feels like they stay up-to-date, have php8 etc.

    I would swop to cmm, but changing O/S (Debian > CentOS) makes me feel very uncomfortable. Or tell me I am wrong ;-)

    My shot at the question: Seems nginx has a speed advantage over Apache.

    Thanked by 1pedagang
  • vyas11vyas11 Member
    edited August 2021

    @dergelbe said:

    @Kassem said:
    https://wordops.net/ (EasyEngine w/o Docker) (free)
    https://centminmod.com/ (free)
    https://runcloud.io/ (paid)

    Wordops uses nginx (cmm also). Wordops is easy to setup and runs well. **This said, it looks a bit like development stopped in 2020 and no updates for a while. **

    Interesting... unless timeline on github is messed up.
    https://github.com/WordOps/WordOps.

    @Kassem said:
    Not sure if you are already aware of these options:
    https://wordops.net/ (EasyEngine w/o Docker) (free)
    https://centminmod.com/ (free)
    https://runcloud.io/ (paid)

    @yoursunny Automatic TLS is not really compelling to drop using Apache and NGINX especially when Certbot works great now. In Ubuntu you don't even need to setup a cron job for renewal anymore.

    One can add slickstack and webinoly to the above list. I believe the developer of slickstack is/was a member on LET. Edit: @jessuppi

  • @Proxecure said:
    I have multiple static and dynamic websites including WordPress, which server is best suited for me ? Currently I am using apache but I heard that for high volume traffic Nginx Is best. Or should I use nginx as a reverse proxy server ? I mean front of Apache

    Define best. What does it mean for you?
    -Ease of configuration?
    -Community/support/documentation?
    -Suitability for your desired use case?
    -Security/updated?
    -Resource usage?
    -Multi-user?

    Define high traffic:
    e.g.
    1000 concurrent users?
    10000 users a day?
    1000000 user a a month?

  • vyas11vyas11 Member
    edited August 2021

    deleted.

  • @vyas11 said:

    @dergelbe said:
    Wordops uses nginx (cmm also). Wordops is easy to setup and runs well. **This said, it looks a bit like development stopped in 2020 and no updates for a while. **

    Interesting... unless timeline on github is messed up.
    https://github.com/WordOps/WordOps.

    I have no idea, but making PHP7.4 default isn't really a noticeable update IMHO. Their changelog ends in 10/20
    https://github.com/WordOps/WordOps/blob/master/CHANGELOG.md

  • raindog308raindog308 Administrator, Veteran

    Just checked and indeed, Apache is still around. Wow...who knew?!? Anyone here still using it?

    I personally dropped that dog at least a decade ago. I think the sole remaining use case is someone who gets aroused by .htaccess files and just can't let them go, or wants to use some ad-inserting module from 2001.

    Use NGINX.

  • nginx vs openlitespeed, which is better?

  • nginx is the best
    if you can do
    and
    if no error

    but most easy is apache

  • @neverain said:
    nginx vs openlitespeed, which is better?

    Depend on your usage and configuration.. mostly nginx perform better..

  • WebProjectWebProject Host Rep, Veteran

    Why not to use both Nginx and Apache, as you can use as reverse proxy, we do use a few projects Nginx as front web server and performance is great.

  • LeviLevi Member

    Apache FTW, a true free solution. Human readable, ton of modules, stable. Nginx can make a difference in busy site, but holy f with their module support. Nginx is built from the ground up to be monetized and converted into their Nginx Plus.

    Thanked by 2pedagang hnzlet
  • rm_rm_ IPv6 Advocate, Veteran
    edited August 2021

    Lighttpd one love <3

    Dealing with Nginx configs is nauseating, and Apache by now is something from 1995, who still uses that.

    That said, I'm using Nginx at the moment, because of the better reverse proxy support (than in Lighttpd).

  • @pedagang said:

    @team_traitor said:
    I'm using Nginx. It is fast and has low memory footprint. There is also a plugin of certbot that automatically creates and renew letsencrypt (Certbot-Nginx)

    cpu usage
    whether cpu saving in nginx ????

    i know apache is ram wasteful, ... but ram is cheap

    i am on varnish + apache + memcached and other cache

    Apache is our first web server when we deployed our ajax heavy web-app and it is slow, we received complains from our client that our website is slow.

    I removed the apache and install nginx (default config) is so awesome. Compared to apache, the nginx rocks and able to handle lots of request. It is is based on my experience so no biased comments here.

    apache slows down when it got around 1-2k request/second on the other hand nginx is able to scale and able to handle 4k-5k request with ease.

    We rarely use static content, so cache is not really suited for us. Almost 90% of request are dynamic and data changes so cache feature is out for us.

    Our server that time is intel corei3 with 16GB ram and 256SSD + 2TB HDD at 1Gbps port speed.

    Nginx wins for me.

    Please do note, that both webserver at that time runs on a default config. I just add the vhost and some ssl settings. Nginx performs better so I did not bother going back with apache again.

    BTW, I used apache on my dev environment (home)

    Now, I tweaked Nginx a little and so far so good. It rocks.

    Thanked by 1pedagang
  • gianggiang Veteran

    @neverain said:
    nginx vs openlitespeed, which is better?

    @chocolateshirt said:

    @neverain said:
    nginx vs openlitespeed, which is better?

    Depend on your usage and configuration.. mostly nginx perform better..

    I was using nginx from the LEB Script day.

    Just switch to OpenLiteSpeed for about a month because it’s so easy to use. They got their own webadmin or you can use with cyberpanel…

  • @giang said:

    @neverain said:
    nginx vs openlitespeed, which is better?

    @chocolateshirt said:

    @neverain said:
    nginx vs openlitespeed, which is better?

    Depend on your usage and configuration.. mostly nginx perform better..

    I was using nginx from the LEB Script day.

    Just switch to OpenLiteSpeed for about a month because it’s so easy to use. They got their own webadmin or you can use with cyberpanel…

    Cyberpanel is stable now ? Need to refresh server if do some tweak ...

  • @vyas11 said:

    @Proxecure said:

    Define high traffic:
    e.g.
    1000 concurrent users?

    if only on one page at drupal or wordpress
    working on cdn + other cache
    then it feels very small traffic

Sign In or Register to comment.