Lighttpd Web Server with PHP Support through Debian Wheezy

1a - For Arm devices setup Debian Wheezy from here (remove lighttpd if is installed from optware with ipkg remove lighttpd or opkg remove lighttpd if installed from entware)

1b - For Mipsel devices setup Debian Wheezy from here (remove lighttpd if is installed from optware with ipkg remove lighttpd or opkg remove lighttpd if installed from entware)

2 - Enter chrooted debian with:

debian enter

3 - Update Debian

apt-get update
apt-get upgrade

4 - Install necessary packages

apt-get install wget lighttpd php5-cgi

- Change server port

sed -i 's/server.port                 = 80/server.port                 = 81/g' "/etc/lighttpd/lighttpd.conf"

6 - Reduce memory limit

sed -i 's/memory_limit = 128M/memory_limit = 16M/g' "/etc/php5/cgi/php.ini"

7 - Start server

/etc/init.d/lighttpd start

8 - Go to 192.168.1.1:81 and if you see this page, the lighttpd web server is configured correctly

lighttpd-debian

9 - Enable PHP

lighty-enable-mod fastcgi-php

10 - Restart server

/etc/init.d/lighttpd force-reload

11 - Create info page

nano /var/www/info.php

Paste this lines

<?php
phpinfo();
?>

Save with CTRL-O, press ENTER and exit nano with CTRL-X
12 - Go to 192.168.1.1:81/info.php and if you see this page, php is configured correctly

lighttpd-php-debian
13 - To create startup script we need to exit debian

exit

14 - Add lighttpd to chroted services list

echo "" >>/opt/etc/chroot-services.list
echo "S80lighttpd-debian" >>/opt/etc/chroot-services.list
chmod 755 /opt/etc/chroot-services.list

15 - Create post-mount script

nano /jffs/scripts/post-mount

Paste this lines

#!/bin/sh
sleep 10
/opt/etc/init.d/S99debian start

Save with CTRL-O, press ENTER and exit nano with CTRL-X

16 - Make script executable

chmod a+rx /jffs/scripts/post-mount

17 - Rename original script to enable autostart from outside debian

mv /opt/debian/etc/init.d/lighttpd /opt/debian/etc/init.d/S80lighttpd-debian

18 - Start lighttpd from outside debian together with mounted external folder

debian restart

19 - Go to 192.168.1.1:81 and should see your homepage


ACCESS THE WEBSITE FROM WAN

nano /jffs/scripts/firewall-start

Paste this lines

#!/bin/sh
iptables -I INPUT -p tcp --destination-port 81 -j ACCEPT

Save with CTRL-O / Enter / and exit with CTRL-X
Make script executable and apply rule
chmod a+rx /jffs/scripts/firewall-start
sh /jffs/scripts/firewall-start

Go to Port Forwarding page http://192.168.1.1/Advanced_VirtualServer_Content.asp and redirect port 80 to 81, now you should have access from wan.

lighttpd-portfw
Enjoy...

Get Email Notification When a Server or Port is Unreachable
SoftEther VPN Running on AsusWRT Routers
Minidlna UPnP Media Server through Debian Jessie Arm
How to Mount Samba Shares inside Chrooted Debian
Minidlna UPnP Media Server through Debian Jessie Arm
How to Mount Samba Shares inside Chrooted Debian
Spreed WebRTC server and web client
Asterisk VoIP Server running on AsusWRT Routers
Get Email Notification When a Server or Port is Unreachable
SoftEther VPN Running on AsusWRT Routers
NZBGet through Entware
Minidlna UPnP Media Server through Debian Jessie Arm

SUBSCRIBE

To be notified by email when a new tutorial is posted :)

Thanks for Subscribing! I'll keeping you up-to-date with latest tutorials!

Something went wrong, try again...