-
Notifications
You must be signed in to change notification settings - Fork 651
Lighttpd web server with PHP support through Entware
First, setup Entware from github RMerl asuswrt-merlin guide.
Login to router with a terminal like putty and enter the commands below.
Additional the openwrt.org wiki helps with customization of the server.
opkg install lighttpd php5-cgi lighttpd-mod-fastcgi
sed -i 's/#server.port = 81/server.port = 81/g' "/opt/etc/lighttpd/lighttpd.conf"
sed -i "/server.upload-dirs*/cserver.upload-dirs = ( \"/opt/tmp\" )" "/opt/etc/lighttpd/lighttpd.conf"
or
# nano /opt/etc/lighttpd/lighttpd.conf
and remove the commenting hash (#) prefix from the server.port
line,
and change the line that starts with server.upload-dirs
from /tmp
to /opt/tmp
.
cat >> /opt/share/www/index.html << EOF
<html>
<head>
<title>lighttpd default page</title>
</head>
<body>
<h2>lighttpd server is running.</h2>
</body>
</html>
EOF
or
# nano /opt/share/www/index.html
and copy and paste the html source code lines from the section above.
cat >> /opt/share/www/test.php << EOF
<?php
phpinfo();
?>
EOF
or by using your favourite text editor:
# nano /opt/share/www/test.php
by copying and pasting only the php source code section from above.
/opt/etc/init.d/S80lighttpd start
Go to router.asus.com:81 and if you see this page, the lighttpd web server is configured correctly:
lighttpd server is running.
Go to router.asus.com:81/test.php and if you see this page, the php-mod-fastcgi is configured correctly
opkg install nano
nano /jffs/scripts/firewall-start
Paste these lines
#!/bin/sh
iptables -I INPUT -p tcp --destination-port 81 -j ACCEPT
Save with Ctrl+O, Enter, and exit nano with Ctrl+X
Give it firewall file the correct file permissions
chmod a+rx /jffs/scripts/firewall-start
Go to Port forwarding page and redirect port 80 to 81, after reboot you should have access from wan.
Youtube video here
Post issues here
Detailed up to date instructions here
^ I could not get the lighttpd php server to work without the directions from this last link ^ would be nice if someone has the time to update this wiki with those directions