# Best web server when resources are not limited?



## vpsnewb (May 20, 2013)

Let's say you're not limited by resources and you purely want the best performance and security from your web server. On a small VPS you may be restricted to utilizing Nginx, for example, as it's more lightweight than Apache out of the box. But, can Apache perform just as well when given proper time and resources? What about lighttpd and litespeed? Hell, does anyone use Cherokee anymore? (It's actually kind of neat)

So, imagine you aren't constrained on resources and you're setting up a server to host a busy site. Which web server do you choose, and why?


----------



## SeriesN (May 20, 2013)

Resource not limited? Why not apache and then move everything to RAM


----------



## Ruchirablog (May 20, 2013)

Well Nginx will still be better.


----------



## Mun (May 20, 2013)

Depends on your application and what you are doing.

Youtubes front end is lighttpd, and its backend for PHP is apache. In many cases still today apache can handle php faster and quicker then any other application as it is built into the process.

I for one couldn't beat my friends load times on his apache setup even though I had a heavily tuned php-fpm/nginx and he had apache. (We were doing php files)


----------



## TruvisT (May 20, 2013)

Mun said:


> Depends on your application and what you are doing.
> 
> Youtubes front end is lighttpd, and its backend for PHP is apache. In many cases still today apache can handle php faster and quicker then any other application as it is built into the process.
> 
> I for one couldn't beat my friends load times on his apache setup even though I had a heavily tuned php-fpm/nginx and he had apache. (We were doing php files)


Was the hardware specs the same?


----------



## sv01 (May 20, 2013)

Mun said:


> Youtubes front end is lighttpd, and its backend for PHP is apache


OMG that really cool, I might testing this when I'm not busy. compare to nginx


----------



## drmike (May 20, 2013)

Cherokee is awesome, but the head developer went to work for a big corporation and the project has idled. Unsure if I'd deploy it heavily at this point.

Nginx is the defacto standard at this point for more 'knowledgeable' folks.  Really solid piece of software with tons of features.  

Would be great to Cherokee-like admin for Nginx.  That would be purrrrfect.


----------



## SeriesN (May 20, 2013)

But why not apache? Given the condition above, Apache can beat anything. I am loving me some apache 2.4 right now.


----------



## NodeBytes (May 20, 2013)

I'm using apache. It's super quick! My personal site www.brendancarlson.me is hosted on a dedicated server with apache and it loads really fast.


----------



## MannDude (May 20, 2013)

buffalooed said:


> Cherokee is awesome, but the head developer went to work for a big corporation and the project has idled. Unsure if I'd deploy it heavily at this point.
> 
> Nginx is the defacto standard at this point for more 'knowledgeable' folks.  Really solid piece of software with tons of features.
> 
> Would be great to Cherokee-like admin for Nginx.  That would be purrrrfect.


Cherokee was pretty slick when I decided to give it a go. Didn't use it for anything production, just wanted to use it. If Nginx has a similar admin/backend/GUI like Cherokee did, my god. That'd be awesome.

I like Apache because of how well documented it is. Still the most used webserver, but I do prefer Nginx over it as I've made myself more familiar with it over the past year or so. My experience with lighttpd isn't that great, although lighttpd _is_ powering vpsBoard at this current time. I did use Litespeed in the past, but I found Apache + Varnish Cache out performed Litespeed, so I can rule out Litespeed.

TL;DR: I don't know.


----------



## drmike (May 20, 2013)

I missed the last line, about large RAM and what would you use...

Nginx is what I use.  Still use other servers though behind Nginx   Lots of Apache stuff that just works and porting it to Nginx isn't quick and easy to translate, rules, etc.

Larger sites I'd do:  Varnish ---> Nginx ---> whatever server.  But this is where good amount of static or media content.

Apache is always capable and perhaps competitive with tweaking, but I've always hated the config style of Apache.


----------



## shovenose (May 21, 2013)

Apache FTW


----------



## ihatetonyy (May 21, 2013)

If you have a fairly large amount of money, my understanding is that LiteSpeed and its caching product (when properly tweaked) can run circles around nginx or Apache.

http://vbtechsupport.com/litespeed/benchmarks/vbjan26/vbindex_ls_ngx_apachevarnish_jan28updated.png


----------



## drmike (May 21, 2013)

ihatetonyy said:


> If you have a fairly large amount of money, my understanding is that LiteSpeed and its caching product (when properly tweaked) can run circles around nginx or Apache.
> 
> http://vbtechsupport.com/litespeed/benchmarks/vbjan26/vbindex_ls_ngx_apachevarnish_jan28updated.png


Problem is those numbers are old --- 2011 

The top speed is Lite + Xcache --- assuming they are serving the same document every time.  So entirely out of the cache/RAM on every request after the first.

They test Apache fronted by Varnish and it didn't lag Lite + Xcache a whole heck of a lot considering.

Oddly they didn't test Nginx fronted by Varnish.

Whole bunch of data missing from the tests too.

When you have the luxury of serving the same document a gazillion times from cache, it is hard to beat plain old Varnish.


----------



## wlanboy (May 21, 2013)

My preference is lighttpd. I use it for small php sites and as a front end proxy for my thin/rails apps.

Proxy setup is quite easy:


```
$HTTP["host"]=~ "domain.com|domain2.com"  {
        proxy.balance = "fair"
        proxy.server =  ("" =>
                        (( "host" => "127.0.0.1", "port" => 4001 ))
                        )
}
```


----------



## drmike (May 21, 2013)

wlanboy said:


> My preference is lighttpd. I use it for small php sites and as a front end proxy for my thin/rails apps.
> 
> Proxy setup is quite easy:
> 
> ...


That's simple as it possibly can get....  Bunch of other crud for the config file though?  Or will lighthttpd run with literally just that?

Have to love front end proxy feature.  It is what I use most --- with Nginx.


----------



## wlanboy (May 21, 2013)

The configuration of lighttpd is quite simple. You have one lighttpd.conf in /etc/lighttpd

and some additional module config files:


/etc/lighttpd/conf-enabled$ ls -al
total 8
drwxr-xr-x 2 root root 4096 Apr 19 09:15 .
drwxr-xr-x 4 root root 4096 Apr 10 12:23 ..
lrwxrwxrwx 1 root root 30 Apr 10 12:12 05-auth.conf -> ../conf-available/05-auth.conf
lrwxrwxrwx 1 root root 35 Apr 10 12:12 10-accesslog.conf -> ../conf-available/10-accesslog.conf
lrwxrwxrwx 1 root root 29 Apr 10 12:12 10-cgi.conf -> ../conf-available/10-cgi.conf
lrwxrwxrwx 1 root root 33 Apr 10 12:12 10-fastcgi.conf -> ../conf-available/10-fastcgi.conf
lrwxrwxrwx 1 root root 31 Apr 10 12:12 10-proxy.conf -> ../conf-available/10-proxy.conf
lrwxrwxrwx 1 root root 29 Apr 10 12:12 10-ssl.conf -> ../conf-available/10-ssl.conf
lrwxrwxrwx 1 root root 32 Apr 19 09:15 10-status.conf -> ../conf-available/10-status.conf
lrwxrwxrwx 1 root root 37 Apr 10 12:25 15-fastcgi-php.conf -> ../conf-available/15-fastcgi-php.conf

B.t.w. I do like the linking to /conf-enabled and /conf-disabled.

That is my whole lighttpd.conf: (so leaving https, auth and php config to the files in /conf-enabled)


server.modules = (
"mod_access",
"mod_alias",
"mod_compress",
"mod_redirect",
"mod_rewrite"
)

server.document-root = "/var/www"
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
server.errorlog = "/var/log/lighttpd/error.log"
server.pid-file = "/var/run/lighttpd.pid"
server.username = "www-data"
server.groupname = "www-data"
index-file.names = ( "index.php", "index.html" )
url.access-deny = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

dir-listing.encoding = "utf-8"
server.dir-listing = "disable"

compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ( "application/x-javascript", "text/css", "text/html", "text/plain" )

include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"

$HTTP["host"] =~ "^domain\.net$" {
url.redirect = ( "^/(.*)" => "http://www.domain.net/$1" )
}

$HTTP["host"]=~ "domain1|domain2" {
proxy.balance = "fair"
proxy.server = ("" =>
(
( "host" => "127.0.0.1", "port" => 4001 )
))
}

$HTTP["remoteip"] =~ "127.0.0.1" {
alias.url += ("/munin/" => "/var/cache/munin/www/")
}

$HTTP["host"]=~ "domain.org" {
server.document-root = "/var/www-org"
}

So what I really like about lighttpd is the fact that based on some rules you can override quite every single server parameter.

Alias, rewrites, Proxy, document-root, just everthing can be configured based on hosts, ips, etc.


----------



## Ruchirablog (May 21, 2013)

bcarlsonmedia said:


> I'm using apache. It's super quick! My personal site www.brendancarlson.me is hosted on a dedicated server with apache and it loads really fast.


Your site is very simple and behind cloudflare. So it should run fast but its not really that fast for me


----------



## wlanboy (May 21, 2013)

My short how-to for lighttpd configuration: http://vpsboard.com/index.php?/topic/244-using-lighttpd-as-a-webservce-and-proxy/


----------



## prometeus (May 21, 2013)

Anybody is running apache 2.4 with php for mid sized sites? How it compare with 2.2?


----------



## wlanboy (May 21, 2013)

@prometeus

After searching for a while I have found a test including apache 2.2 and apache 2.4:

http://www.rootusers.com/web-server-performance-benchmark/

Looks like apache 2.4 is really faster thatn apache 2.2.


----------



## prometeus (May 21, 2013)

wlanboy said:


> @prometeus
> 
> After searching for a while I have found a test including apache 2.2 and apache 2.4:
> 
> ...


Thanks,  I saw this before, but it doesn't include php if I remember well and it would be nice if someone can share a real experience with apache 2.4 with php in a production environment


----------

