lighttpd-Support

I just wanted to ask if you are working on lighttpd-support, because lighttpd is very fast and good configurable...

If you haven't started such a thing yet, I did it (only poorly, but effective...)

It's quite easy but effective:
- I made a PHP-Script to query my ispconfig-vhosts from mysql and return lighttpd configuration directives
- I added the script to my lighty-config (include_shell "/root/ispconfig/patchwork/lighttpd_vhosts.php")

And adapted the config to run under my webserver-user (www-data:www-data) ... Basically, that's it... I currently leave ispconfig and it's components untouched, but i would need to write some stuff that makes makes me .htaccess-files out of the "custom apache parameter" option... But that's not my no1 priority right now...

It would be pretty nice if you would offer something like this built-in, because it is unbeleavable easy, and ispconfig would then support a living alternative to the big big apache... ;-)

This expects debian/ubuntu style lighttpd-package, where there is a mime-script at /usr/share/lighttpd/create-mime.assign.pl ... you can comment the line and put the mime-handling from the example-config in it if you don't want this.

Maybe you have to adapt the fastcgi-configuration to your needs, for example if your php-cgi fastcgi enabled binary is not at /usr/bin/php5-cgi ... Also, this is my lightweight configuration example (only a few fcgi-processes)

You can create the entire lighttpd-config this way from MySQL-Informations, they will refresh every time you reload lighty... So it is quite easy to switch from apache2 to lighty without making major changes to existing apache2-configs...

As you can see, while I don't know much about ISPCONFIG-Internals, my script is poorly using it's features, I guess you can make one much better in five minutes or so ;-)

However, someday I should use the config.inc stuff to connect to mysql...

And: You should update the apache_reload-function to restart lighttpd instead of apache, I've done it, but I forgot where... But this solution is VERY stable...

You can adapt the settings below "Static Preferences" with values from ispconfig...

Yes, and I made php a bit more secure by creating php_safe.ini für safemode, set open_basedir to /var/www there and as tempdir /var/www/tmp ... However, it would be absolutely easy to use the suexec-stuff and improve this even more, maybe I'll do this someday ;-)

Okay... My step-by-step instruction... But one thing: I use Debian/Ubuntu-Style Lighty (ready to use with the mime-type-scripts), and I don't know how SuSE/Fedora/etc. packages look like...

However

Install ISPconfig with Apache2 (this is nessasary, while ISPconfig doesn't support lighttpd by itself)... After the installation, stop apache2 and disable it (Ubuntu/Debian: Edit /etc/default/apache2, there is an option)

Install LighttpD, in debian/ubuntu: apt-get install lighttpd ... You can build it from source, but you'll need the mime-script at /usr/share/lighttpd/create-mime.assign.pl or replace the include-line in lighty-config later by a default mime-handling ... After the installation, make sure lighty is stopped: /etc/init.d/lighttpd stop

Make sure PHP5 with fastcgi is installed and at /usr/bin/php5-cgi ... in debian/ubuntu you can usually do this by apt-get install php5-cgi ... Then generate a safe-mode config for php at /etc/php5/cgi ... just copy the php.ini there to php_safe.ini, and enable the safemode-option in there. But for now this is not elementary ;-) ...

Make sure there is a tmp-directory for your webscripts... It's usually at /var/www/ ... so make: mkdir /var/www/tmp ... then chown it for the webserver: chown www-data:www-data /var/www/tmp ... I usually change then the session-directory in php.ini to this location as well, but this is non-vital.

Use my files from the last posting. Put lighttpd.conf to /etc/lighttpd and the script (lighttpd.conf.php) to /root/ispconfig/scripts/ ... Make the script executeable: chmod 755 /root/ispconfig/scripts/lighttpd.conf.php

Then, you can fine-tune the lighty-config if you want... Some of the options are in the php-script as well, but for now you can leave it as-is...

Modify the lighttpd.conf.php to fit your database-configuration (username/password/database) ... For now this is nessasary ;-)

Then, create some website in ispconfig, so that we can test the configfile-generation

Run the config-script, and check it's output: /root/ispconfig/scripts/lighttpd.conf.php ... No error-Messages? Good... That means, that the config-generater works well. Then you can test lighty by running as root: lighttpd -D -f /etc/lighttpd/lighttpd.conf ... It should start without errormessages and you should now reach the prevously created host. Done. This way you can easily upgrade existing installations. You can stop the lighty with [CTRL]+[C] and then start it normally by /etc/init.d/lighttpd start

Now you have to modify the ispconfig-script for apache-reboot... Edit /root/ispconfig/scripts/lib/config.lib.php ... Arround line 2374 (near the end) is the function: "function apache_reload(){" ... Rename the function, so that the line looks like: "function apache_reload_off(){" ... Over the function, put this:

... It's dirty, but it works well ;-) ... Don't use "restart" or "reload", while this doesn't work well in most distributions... I'll send a better version of the script to the ubuntu people soon, but for now this is one good way...

Now, everything should work well, even if ispconfig still "believes" that it's erving for apache2 ;-)

That's the way I did it, and how it's running at my testserver, wich currently hosts for example this page: pb.exw.at ... Works stable, but needs much more integration into ispconfig...

can you give me a hand with a similar problem?
I would like to manually compile and install lighttpd on my debian box, have it lsitening on a different port i.e. 88 and import the vhosts from apache.

I plan on using mod_proxy on my apache2 so apache2 will stay the default webserver BUT have it forward static content to lighttpd (I have figured out the forwarding part, but need help with the compilation on debian (running 3.1)

If this works out I'd like to also use lighttpd for ruby on rails

can you help? I could open another thread? or you could send me a pm or whatever

I just started using this script, and discoverd two flaws:
- it doesn't support wildcard domains, something I frequently use
- the .htaccess patch is to slow on big sites (and i mean BIG, over 100k folder really kills the perfornance)

Below is a patched version that adds wildcard support.
The .htaccess patch is included but disabled
I also added a few extra lighttpd options; especially a port parameter, so you can run lighttpt next to your apache2 to test the performance/validy of this script.