# lightweight httpd needed



## bigearsbilly (Mar 27, 2012)

I have a few servers so lots of log files. (These are application logs not /var/logs). I would like to fire up the browser and read my log files in the browser. I don't want to log on and trawl through all the servers.

I notice apache uses quite a bit of memory.

So I was interested if anyone can recommend a nice lightweight web server. It must have CGI though, I do a lot of perl CGI stuff. I am particularly interested in www/nginx and www/lighttpd.


----------



## Beeblebrox (Mar 27, 2012)

Those two work fine, are not memory hogs, work fine with cgi and fastcgi. There's also www/varnish. From what I can tell (and I may be completely wrong) nginx is making quite a bit of headway lately and has jumped a little ahead of the rest of the pack.


----------



## mix_room (Mar 27, 2012)

You might be better off having a cron-job ship the logs to another machine. Needn't be more difficult than running a scp-job.


----------



## bigearsbilly (Mar 27, 2012)

*S*huffling logs about is a pain. Tried all that, it frazzles your brain. Plus it's network traffic, I probably will not always look at them, only when I have a query.

I already got cron-job-itis.


----------



## bes (Mar 27, 2012)

How about www/hiawatha


----------



## Beeblebrox (Mar 27, 2012)

AFAIK, hiawatha is a fork of apache (so shares most of the code), while the the other three mentioned http servers are complete, ground-up re-writes of code.


----------



## drhowarddrfine (Mar 27, 2012)

@Beeblebrox - Yes, you are right. lighttpd is probably lighter but there are other even smaller ones out there, of course.


----------



## bigearsbilly (Mar 27, 2012)

I am currently trying this:
www/thttpd

*H*ere's my config file!


```
user=www
port=1080
dir=/TMI/logs
chroot
logfile=/dev/null
pidfile=/TMI/var/thttpd.pid
```
Now that is easy.

*A*nd look at all these dependencies, shocking.


```
$ ldd /usr/local/sbin/thttpd
/usr/local/sbin/thttpd:
        libcrypt.so.5 => /lib/libcrypt.so.5 (0x800658000)
        libc.so.7 => /lib/libc.so.7 (0x800771000)
```

Can only do static linked compiled CGI, so no perl or shell, but it's up and running and I am very busy so it'll do for now.


----------



## Beeblebrox (Apr 2, 2012)

Hi, I thought I would give it a spin as well, but ran into a snag. My thttpd runs jailed, the server starts up, but all I get in my browser is the pink 404 page. My thttpd.conf (not sure if *host* setting binds thttpd to specific IP, which is my intention):

```
user=www
dir=/dbhttp
nochroot
nosymlink
vhost
charset=utf-8
#cgipat=*.cgi
cgipat=/cgi-bin/*.*
logfile=/var/log/www/thttpd.log
pidfile=/var/run/thttpd.pid
host=192.168.2.100
```


----------



## bigearsbilly (Apr 3, 2012)

Have you looked at the web site thttpd/notes.html? The developer appears to be a FreeBSD fan so he may have a solution.

I must say I like it. I can easily browse my logs on all my servers and so can my colleagues, plus it cost virtually nothing. Almost zero configuration install.


----------



## Beeblebrox (Apr 3, 2012)

I did read the notes and other stuff, I also e-mailed the developer some days ago - he probably will get around to answering eventually.
I think the description for start-up in notes is out-dated, because /usr/local/etc/rc.d/thttpd seems to have the same code anyway. How do you start the server? I just do a "*service onestart*".
The 404 makes me think that dir= is not being read correctly, but you have it working so that's that...


----------



## bigearsbilly (Apr 4, 2012)

The fact you have the thttpd 404 implies it's working I reckon.
I start the service normally in rc.conf.
I suppose you've read the log file ;-)


----------



## Beeblebrox (Apr 4, 2012)

I also installed it on the host itself (not in jail) so I could de-bug easier. After start-up and query through browser only thing log shows:

```
127.0.0.1 - - [04/Apr/2012:15:****] "GET /localhost/ HTTP/1.1" 404 0 "" "Mozilla/5.0 (X11; FreeBSD
amd64) AppleWebKit/534.26+ (KHTML, like Gecko) Version/5.0 Safari/534.26+ Epiphany/2.30.6"
127.0.0.1 - - [04/Apr/2012:15:****] "GET /localhost/favicon.ico HTTP/1.1" 404 0 "http://localhost/"
"Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/534.26+ (KHTML, like Gecko) Version/5.0 Safari/534.26
+ Epiphany/2.30.6"
```


----------



## jem (Apr 4, 2012)

Beeblebrox said:
			
		

> There's also www/varnish.



Varnish is a reverse-proxy/accelerator, not an http server in its own right.


----------



## Beeblebrox (Apr 4, 2012)

@jem: yeah, you're right - I forgot about that small detail. Too much reading, too little thinking.


----------



## Beeblebrox (Apr 17, 2012)

@magna-aures-William:
I got the service running by modifying thtttpd.conf (disabled 1-3, enabled 4th):

```
1- #nosymlink
2- #vhost
3- #cgipat=/cgi-bin/*.*
4- cgipat=*.cgi
```
Files with php extensions are not working though and all I get for the sub-folders under www is a dir-listing. Obviously my cgipat is wrong somehow as opening www/folder/index.php just shows that file as php code.

I would also like to get vhost working and I have no clue why vhost gives problems.


----------



## Hiawatha (Jun 3, 2012)

Beeblebrox said:
			
		

> AFAIK, hiawatha is a fork of apache (so shares most of the code), while the the other three mentioned http servers are complete, ground-up re-writes of code.


As the author of the Hiawatha webserver, I seriously feel insulted by this post. The Hiawatha webserver has completely been written from scratch and does not share a single line of code with that crappy webserver!


----------



## graudeejs (Jun 3, 2012)

I wonder where did that "fork" misinformation came from


----------



## Beeblebrox (Jun 4, 2012)

@Hiawatha: No need to get insulted; AFAIK *implies* the "correct me if I'm wrong" caveat, AFAIK! So thanks for the correction and for helping us to be better informed. Maybe you could even post some nice links to comparisons with other servers re speed, memory usage, etc.


----------



## Hiawatha (Jun 4, 2012)

@Beeblebrox: ok, no problem.

One comparison I know of: http://www.hiawatha-webserver.org/files/PHP_web_serving_study.pdf


----------



## bigearsbilly (Jun 4, 2012)

So Mr Hiawatha I take it your webserver is better than all the others!


I just tried it on puppy linux and it seems to do what I need. I.e. Perl CGI.
I will give it a go when I get back to work!


----------



## gpatrick (Jun 5, 2012)

I am preparing to switch my domains from Pound/Apache to Nginx/Hiawatha.


----------



## Hiawatha (Jun 5, 2012)

@bigearsbilly: I leave that up to you to decide 

@gpatrick: Hiawatha has reverse proxy functionality too, so there is no more need for nginx.


----------



## expl (Jun 5, 2012)

My personal choice is nginx (sendfile, tcp_nopush) + fastcgi (prefork) + memcached (for nginx cache and dynamic application caches). It*'*s the fastest setup I could get after a lot of experimenting and works very well with big frameworks like RrubyOnRails and Django.

For logging you can set up a single host just for gathering logs for all of your machines. Take a look at this manual http://www.freebsd.org/doc/handbook/network-syslogd.html.


----------



## bigearsbilly (Jun 6, 2012)

They aren't system logs, just logs from scripts, cron jobs, configs etc.
Setting up remote syslog is bit of a sledgehammer. 
I've never really liked using syslog for user mode stuff. You have to make all scripts use it.

It's dead easy to do:

```
exec > $log
exec 2>&1
```

Mostly though, I have very limited resources, especially time!


----------



## bigearsbilly (Jun 6, 2012)

@hiawatha

Righto, I am testing.


----------



## expl (Jun 6, 2012)

bigearsbilly said:
			
		

> They aren't system logs, just logs from scripts, cron jobs, configs etc.
> Setting up remote syslog is bit of a sledgehammer.
> I've never really liked using syslog for user mode stuff. You have to make all scripts use it.
> 
> ...



I don't understand where you see this "sledgehammer"...

It*'*s as simple as:

```
exec 2>&1 | logger -h logger.host.com -t "my_app"
```

Or you can set up a very small and simple crontab script to flush the log files to syslogd in time periods (check logger() -f option). Setting up remote syslogd is also quite simple (check the manual from the previous post).

Its not a matter of resources its just a matter to not be stubborn and thinking outside one mindset .


----------

