Project Name | LIGHTHTTPD |
---|---|
Documentation URL | |
Page Content By | |
Last Updated | September, 08 2014 - 12:58PM MST |
These instructions are for Debian/Ubuntu but can be modified for CentOS using the following link
http://sysadminman.net/blog/2008/configuring-lightppd-for-use-with-asterisk-freepbx-41
Install
Install packages
apt-get install lighttpd php5-cgi spawn-fcgi |
Add to /etc/rc.local to start fast cgi on boot
echo -n "Starting FCGI handler for FreePBX... " /usr/bin/spawn-fcgi -f /usr/bin/php-cgi -a 127.0.0.1 -p 4001 -C 2 -u asterisk -g asterisk |
Edit /etc/lighthttpd/lighthttpd.conf
server.modules = ( "mod_access", "mod_alias", "mod_compress", "mod_redirect", "mod_rewrite", "mod_fastcgi", "mod_auth" ) fastcgi.server = ( ".php" => (( "host" => "127.0.0.1", "port" => 4001 ))) $HTTP["remoteip"] !~ "192.168.7|154.147.281.10" { #use this if you want to limit $HTTP["url"] =~ "^/" { #access to listed IPS, in this example url.access-deny = ( "" ) #192.168.7.0/24 and 154.147.281.10/32 } } server.document-root = "/var/www/html/" #(or /var/www/) server.upload-dirs = ( "/var/cache/lighttpd/uploads" ) server.errorlog = "/var/log/lighttpd/error.log" server.pid-file = "/var/run/lighttpd/lighttpd.pid" server.username = "asterisk" server.groupname = "asterisk" index-file.names = ( "index.php", "index.html", "index.htm", "default.htm", " index.lighttpd.html" ) url.access-deny = ( "~", ".inc" ) static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" ) include_shell "/usr/share/lighttpd/use-ipv6.pl" dir-listing.encoding = "utf-8" server.dir-listing = "enable" 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" |
Set Permissions
chown -R asterisk:asterisk /var/www/ chown -R asterisk:asterisk /var/cache/lighttpd chown -R asterisk:asterisk /var/log/lighttpd |
Edit /etc/cron.daily/lighthttpd to look like
#!/bin/sh # Cleanup lighttpd compress cache cache=/var/cache/lighttpd if test -d "$cache/compress"; then su -s /bin/sh -c "find $cache/compress -type f -atime +30 -print0 | xargs -0 -r rm" asterisk fi if test -d "$cache/uploads"; then su -s /bin/sh -c "find $cache/uploads -type f -atime +1 -print0 | xargs -0 -r rm" asterisk fi |
That should be it, after starting lighttpd should work with freebpx running with asterisk owner.