WebFaction
Community site: login faq

Is it possible to install an app running on lighttpd instead of Apache?

For instance, the official web2py install script with default settings and the built-in demo app alone uses over 170mb of RAM. That's just running the admin page and the Welcome demo page. Well over the 80mb allotted in the default hosting plan. I had to tweak my server settings quite a bit to keep from getting my processes killed after installing it.

If the official web2py script followed this guide and used lighttpd instead of Apache, server load by default would be a fraction of what it is with the current option.

Is there a current way to write a script for this or could there be in the future?

asked 24 Nov '11, 00:06

HittingSmoke
4822230
accept rate: 8%


Is there a current way to write a script for this or could there be in the future?

Yes, there is a way to write a script to install web2py with lighttpd instead of Apache.

The existing unofficial WebFaction web2py installer uses the WebFaction control panel API to create the application. You can use that script as a starting point and modify it to build lighttpd as a custom app (instead of installing our mod_wsgi + Apache stack), and then have it configure lighttpd to serve web2py.

permanent link

answered 24 Nov '11, 08:43

seanf
12.2k42136
accept rate: 37%

Thanks. I'm having a bit of a problem configuring lighttpd to use web2py though. I've got lighttpd running and I've tested with with a basic HTML file, but when I try to configure it for web2py and FastCGI I get errors when starting the server:

2011-11-24 17:38:35: (log.c.166) server started 
2011-11-24 17:38:35: (server.c.968) WARNING: unknown config-key: accesslog.filename (ignored) 
2011-11-24 17:38:35: (server.c.968) WARNING: unknown config-key: url.access-deny (ignored) 
2011-11-24 17:38:47: (mod_fastcgi.c.1732) connect failed: No such file or directory on unix:/tmp/fcgi.sock 
2011-11-24 17:38:47: (mod_fastcgi.c.3025) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 1 
2011-11-24 17:38:49: (mod_fastcgi.c.3595) all handlers for /handler_web2py.fcgi/? on /handler_web2py.fcgi are down. 
2011-11-24 17:38:49: (mod_fastcgi.c.2852) fcgi-server re-enabled: unix:/tmp/fcgi.sock 
2011-11-24 17:38:51: (mod_fastcgi.c.1732) connect failed: No such file or directory on unix:/tmp/fcgi.sock 
2011-11-24 17:38:51: (mod_fastcgi.c.3025) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 1 
2011-11-24 17:38:53: (mod_fastcgi.c.3595) all handlers for /handler_web2py.fcgi/? on /handler_web2py.fcgi are down. 
2011-11-24 17:38:53: (mod_fastcgi.c.2852) fcgi-server re-enabled: unix:/tmp/fcgi.sock 
2011-11-24 17:38:54: (mod_fastcgi.c.1732) connect failed: No such file or directory on unix:/tmp/fcgi.sock 
2011-11-24 17:38:54: (mod_fastcgi.c.3025) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 1 
2011-11-24 17:38:54: (mod_fastcgi.c.3595) all handlers for /handler_web2py.fcgi/? on /handler_web2py.fcgi are down. 
2011-11-24 17:38:56: (mod_fastcgi.c.2852) fcgi-server re-enabled: unix:/tmp/fcgi.sock

Am I using FastCGI improperly? I've found references to /tmp/fcgi.sock in scripts on the old Webfaction forums via Google, but I can't find anything current.

(24 Nov '11, 11:14) HittingSmoke

It sounds to me like you haven't started your web2py FastCGI handler process (which is what creates the socket file). Try doing something like this...

cd ~/webapps/app_name/web2py
nohup python2.7 fcgihandler.py &

... then restart your lighttpd server.

Also, I advise that you edit fcgihandler.py and your lighttpd configuration file to change the socket location to a file within your home directory, like "/home/you/webapps/lighttpd/fcgi.sock" - otherwise, some other user who is trying to follow the same guide might try to attach to your socket, or you might try to attach to his.

(24 Nov '11, 12:51) seanf

That got rid of the No such file or directory error, but now I'm getting permission denied issues:

2011-11-24 17:15:35: (server.c.1519) server stopped by UID = 545 PID = 24688 
2011-11-24 17:15:48: (log.c.166) server started 
2011-11-24 17:15:48: (server.c.968) WARNING: unknown config-key: accesslog.filename (ignored) 
2011-11-24 17:15:48: (server.c.968) WARNING: unknown config-key: url.access-deny (ignored) 
2011-11-24 17:15:53: (mod_fastcgi.c.1732) connect failed: Permission denied on unix:/tmp/fcgi.sock 
2011-11-24 17:15:53: (mod_fastcgi.c.3025) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 1 
2011-11-24 17:15:55: (mod_fastcgi.c.3595) all handlers for /handler_web2py.fcgi/? on /handler_web2py.fcgi are down. 
2011-11-24 17:15:55: (mod_fastcgi.c.2852) fcgi-server re-enabled: unix:/tmp/fcgi.sock
(24 Nov '11, 17:18) HittingSmoke

That's because another user on your server has ownership of /tmp/fcgi.sock, which is exactly why I recommend that you modify fcgihandler.py and your lighttpd configuration file to change the socket location to a file within your home directory, like "/home/you/webapps/lighttpd/fcgi.sock".

(24 Nov '11, 17:41) seanf

Yikes, I'm an idiot. I somehow completely missed that part in your original reply, sorry.

I've got the server running with web2py now. Just need to sort static files as css and images aren't rendering.

(25 Nov '11, 01:24) HittingSmoke

You may build custom HTTP servers on your account like lighthttpd. You would first create a 'custom application' in the control panel following this documentation. You would than log in to the server with SSH, download the source code, build, than configure it. We do not plan on adding lighthttpd to the list of supported server installers any time soon. We provide apache since its the most stable and supported, but it is common for people to try other stacks for python like lighthttpd, nginx, passenger or gunicorn to name a few.

permanent link

answered 24 Nov '11, 00:33

johns
5.4k412
accept rate: 23%

edited 24 Nov '11, 00:35

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×98
×24
×4

question asked: 24 Nov '11, 00:06

question was seen: 6,284 times

last updated: 25 Nov '11, 01:24

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM