1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Apache -vs- nginx -vs- lighttpd?

Discussion in 'Off Topic' started by Adam Howard, Feb 20, 2011.


Apache -vs- nginx -vs- lighttpd?

  1. Apache

    10 vote(s)
  2. Nginix

    28 vote(s)
  3. Lighttpd

    9 vote(s)
  4. Other

    9 vote(s)
  1. Adam Howard

    Adam Howard Well-Known Member

    Apache -vs- nginx -vs- lighttpd?

    So which do you prefer and why?
  2. majdi

    majdi Well-Known Member

    litespeed ;)
    ankurs likes this.
  3. DregondRahl

    DregondRahl Member


    Easier config, atleast for me.
  4. Luke F

    Luke F Well-Known Member

    nginx - simpler configuration than any other web server, while also being arguably the fastest and lightest.

    I've got it constantly handling 200 or so simultaneous connections (mostly static images and keep-alive) with ~5MB memory usage and ~0.0002% cpu time over the past 45 days (assuming I did the maths right).

    Plus some of the stuff you can do in its config files is incredible, like if statements, variables, and even embedded perl.
  5. DregondRahl

    DregondRahl Member

    Speaking of fast, your gaming forum has blazing speed compared to the other XenForo forums I have seen, its almost double this forum speed. Whats the secret ?
  6. Luke F

    Luke F Well-Known Member

    Could be any of: Nginx (with a 2500+ line config >.>), PHP-FPM, APC (with XenForo set to use it for internal caches), decently configured MySQL (around 0.004s spent on queries in XF on most pages), decent hardware (quad core server, though probably cancelled out by the amount of other stuff running :p), Linux (<3 Fedora), decent network/isp.

    Over the 2 or so years I've been fiddling with this server, the most noticeable improvements in forum performance (phpBB 3, vB 3.8, vB 4.0 and XF) have come from the switch to Nginx from Apache (anyone using Apache or similar servers such as Litespeed or Zend should seriously consider switching), and then from standalone FastCGI processes (used to run Windows; was still faster than proxying to Apache) to PHP-FPM. And of course the switch from Windows to Fedora, but I doubt that's a concern for many :)
  7. dutchbb

    dutchbb Well-Known Member

    I'm also considering switching from Apache to Nginx, I've heard good things about it, especially for big boards / sites. Just the loss of a control panel is something to get used to, but I'm not using it a lot anyway.
  8. DregondRahl

    DregondRahl Member

    2500+ line config o.o sounds like a recipe book XD

    Most likely its the MySQL (0.004s are incredible for those JOINS) and Nginx config then. Whats the memory usage for loading the mainpage? Fedora and Debian <3 for me. The only reason I used Lighty was because php5.2 was required for a project and it was easier to let Lighty handle the fcgi part. I really have to benchmark XenForo on Nginx later. Any -hint- for getting Nginx config running a little smoother?
  9. Luke F

    Luke F Well-Known Member

    Page Time: 0.0431s
    Memory: 2.5909 MB (Peak: 3.1432 MB)
    Queries (12, time: 0.0042s, 9.8%)
    Why not just use the PHP-FPM patch on PHP 5.2?

    Use a nice long keepalive time (I use 5 minutes, probably a bit too far for large forums :p), stick to 1 worker process (might be just me, but performance seems to deteriorate otherwise), use epoll, sendfile, etc.
  10. DregondRahl

    DregondRahl Member

    Wow, certainly a well tuned MySQL! Memory might have improvement with xCache rather than APC however o.o

    I had trouble compiling the patch right with the latest version at the time, so I went with Lighty to save time so I can work on getting the site 5.3 compatible. However I find Lighty's rewrite rules a pain in the ...

    5mins or 5seconds o.o? 5mins is aloong keepalive (though Nginx should be able to handle it still) Also what about tcp_nopush, tcp_nodelay both 'on'?

    Thanks for the tips !
  11. Luke F

    Luke F Well-Known Member

    Yeah I have those both on, also you should ideally have access_log off for static content.
  12. DregondRahl

    DregondRahl Member

            location /forum/ {
                try_files   $uri $uri/ /forum/index.php?$uri&$args;
                access_log  off;
                expires     max;
    I'm doing that, its very effective especially if not much changes. Only wish Nginx could merge files (multiple CSS and JS) like Lighty does with LUA, though your PHP version works pretty good too.
  13. Luke F

    Luke F Well-Known Member

    That could probably be done with the embedded perl - it's certainly possible to use it to minify JS anyway.
  14. Blandt

    Blandt Well-Known Member

    Anyone tried Cherokee ?

    decent little guy with a GUI admin for people with a gazillion sites .. click click and the siteS are live :D http://www.cherokee-project.com/

    I will post the config files for xenforo tomorrow, it's actually super simple via the admin panel few clicks and full SEO is on
  15. SneakyDave

    SneakyDave Well-Known Member

    I tried Cherokee, the fact that the administration is all the GUI confused me! I needed a command line to feel better about myself. Is it still being actively supported? I haven't visited it in a few months.
    Blandt likes this.
  16. Blandt

    Blandt Well-Known Member

    hahahaha ... same here :D
    but you know ... the new version (came out last week) is just out of this world ... they added a store thing, you pick your application ... and .. install ... done.! Everything is configured a la Windows !! :D
    I love it ... it's just that no big sites are using it yet (unlike nginx proven reliability) ... but I will give these guys couple of years, and I'll bet they will rival nginx, especially the GUI thing, and the click-install are so easy .. will bring regular Joes in masses .. I mean you don't even need cPanel
    SneakyDave likes this.
  17. Slavik

    Slavik XenForo Moderator Staff Member

    I was considering using cherokee on my new server, the results seem amazing. If you could post your config would be great.
  18. Blandt

    Blandt Well-Known Member

    Very simple 2 rules :

    click on your vServers tab, then your domain (vserver) >>> select behavior tab >>> click Rule Management >>> click the plus sign to ad a rule >>> select Redirection >>> Click Add new Regex
    Select Internal redirection
    On the Regular Expression text box enter : /?(.*)
    on the Substitution Text box enter : /index.php?/$1 (assuming xenforo is located at the root, if it's in a subfolder like community then >>> /community/index.php?/$1 )


    click + to add another rule select directory and enter : (data|js|styles|install)
    on the handler screen select : HTTP Error
    and on the HTTP Error drop down menu select : 403 forbidden

    Hit save, >> Graceful Restart

    I will take screen shots / or record a video when I get the chance :)
    Slavik likes this.
  19. Deebs

    Deebs Well-Known Member

    Mike has stated that the data directory is exposed to browsers in certain conditons so you don't want to deny access to it.
    SneakyDave likes this.
  20. SilverCircle

    SilverCircle Well-Known Member

    Cherokee looks indeed like a very viable alternative. Nice feature set, good performance, easy configuration - it's all there. What it needs is to prove its reliability and robustness in a production environment. The last version I tested (though quite a while ago, so lots of things might have changed) had some issues with (simulated) high load scenarios.

Share This Page