Lighttpd vs. nginx

anigma

New Member


Messages: 15

Howdy. I'm currently thinking about moving from apache to either lighttpd or nginx in the near future. The reason for this is simple, I just need a lightweight HTTP server that can easily be configured (ie, setting up virtual hosts, user directories, directory listings and such). I also require PHP to be installed since I run a few applications based on PHP (postfixadmin, wordpress, roundcube).

Are there any main reasons to go for one over the other considering my requirements?

I have read a great deal lighttpd vs nginx articles, but none really describe in detail appropriate uses for the two HTTP servers. If you guys know of such articles or reviews, I'd appreciate if you point me to them.
 

drhowarddrfine

Son of Beastie

Reaction score: 1,206
Messages: 3,191

It's been a while but I always struggled getting anything to work with lighty. I also have the impression that its universe is much smaller than all the others but anyone could prove me wrong. nginx always worked for me from the first time I used it and there seems to be far more information out there. Until just recently, all development was done on FreeBSD, too, but for technical reasons, I don't have any answers.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,565
Messages: 30,285

I would suggest sticking to Apache. Although nginx is a fine web server, it's really meant to serve static pages. You can configure nginx to use PHP but setting up more than one PHP application on the same server is a royal PITA to get working and still keep things secure. In this respect Apache is a lot simpler and safer to configure.
 

uzsolt

Well-Known Member

Reaction score: 50
Messages: 269

I'm not professional but I think nginx's configuration is simple - if you understand it :)
One thing: on nginx (and as I see on lighttpd too) can't use .htaccess - they don't support it (see here).
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,565
Messages: 30,285

uzsolt

Well-Known Member

Reaction score: 50
Messages: 269

Off: SirDice as I said I'm not professional (and my english isn't professional too) so I don't understand you exactly. Can you post a simple example please?
 

gkontos

Daemon

Reaction score: 480
Messages: 2,152

From a professional point of view, there is a misconception that Nginx is faster and safer than Apache. This gives a false perception that you are running a faster and more secure web server.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,565
Messages: 30,285

Can you post a simple example please?
No, I don't have any simple examples. That's more or less the point I was trying to make. Configuring nginx may look simple but it usually isn't. Some time ago I spent several days trying to get two PHP applications to behave nicely together on the same server. I either ended up with a working configuration that was insecure or a secure configuration that didn't work. In the end I just gave up, installed Apache and had a working, secure, configuration in a few minutes. What I'm trying to say is, don't be fooled by the apparent simplicity of the configuration.
 

uzsolt

Well-Known Member

Reaction score: 50
Messages: 269

Ah, understand now :)
Many people say that nginx configuration is difficult and apache configuration is simpler. I think most people use apache and know it well. I'm using nginx and after the some first difficult things I like it and now it isn't difficult for me :)
 

Jeckt

Member

Reaction score: 17
Messages: 73

You're right about those familiar with Apache advocating it's simplicity. What in the hell is with those pseudo html style tags in the configuration anyway? I think a big part of Apache's problem is default installs have a TON of unneeded crap which clutter the config file substantially. When you cut out unneeded junk, it's not half as bad. If you keep it simple, Nginx is very simple at first. The way it's architecture works using hash tables for performance, it can get hairy.

I used lighttpd years back, but got away from it. It seems like development has stagnated (not interest in http2 for instance), and it never worked quite right (maybe just on FreeBSD?). If using PHP-FPM you'll probably find Nginx fairly simple. If not, Apache will likely be easier. I'd still give nginx a shot, I've been pretty happy with it - mind you I still use Apache for some things too, sometimes together with Nginx.
 

drhowarddrfine

Son of Beastie

Reaction score: 1,206
Messages: 3,191

Some additional notes from my usage.

I originally started using nginx because it meant I could run it on smaller servers and configuration was definitely easier and nginx is definitely faster. However, nothing I do is highly complex and Apache made changes, since I started, that makes it competitive with nginx in speed. Apache loaded lots of things I would never use though they can be removed. nginx adds nothing extra unless you ask for it. I could find myself back on Apache if things started getting complicated but ...

It's been a while since I've bothered to look at things so take what I said with a grain of salt.
 
Last edited by a moderator:

diizzy

Well-Known Member

Reaction score: 61
Messages: 260

nginx will do just fine and as other have mentioned and will probably give you a better overall overview. You can however do bad/stupid things using both nginx and Apache so I don't think that's a valid point for either side. nginx also has a slight advantage if you're low on resources.

That said, I've found some PHP applications that I never got to work using nginx. Mostly because debugging (logging) is painfully bad between nginx and PHP.
//Danne
 
Top