1 - Install Entware-NG from here
2 - Install lighttpd
opkg install lighttpd
3 - Choose 81 as lighttpd server port and fix uploads directory
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"
sed -i "/server.upload-dirs*/cserver.upload-dirs = ( \"/opt/tmp\" )" "/opt/etc/lighttpd/lighttpd.conf"
4 - Restart server
/opt/etc/init.d/S80lighttpd restart
5 - Create test page
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
<html>
<head>
<title>lighttpd default page</title>
</head>
<body>
<h2>lighttpd server is running.</h2>
</body>
</html>
EOF
Press ENTER
6 - Go to 192.168.1.1:81 and if you see this page, the lighttpd web server is configured correctly
7 - Create php info page
cat >> /opt/share/www/info.php << EOF
<?php
phpinfo();
?>
EOF
<?php
phpinfo();
?>
EOF
Press ENTER
8 - Install PHP
opkg install lighttpd-mod-fastcgi php7-fastcgi
9 - Enable PHP
cat >> /opt/etc/lighttpd/conf.d/30-fastcgi.conf << EOF
server.modules += ( "mod_fastcgi" )
fastcgi.server = ( ".php" =>
( "localhost" =>
( "socket" => "/tmp/php-fcgi.sock",
"bin-path" => "/opt/bin/php-fcgi",
"max-procs" => 1,
"bin-environment" =>
( "PHP_FCGI_CHILDREN" => "2",
"PHP_FCGI_MAX_REQUESTS" => "1000" )
)
)
)
EOF
server.modules += ( "mod_fastcgi" )
fastcgi.server = ( ".php" =>
( "localhost" =>
( "socket" => "/tmp/php-fcgi.sock",
"bin-path" => "/opt/bin/php-fcgi",
"max-procs" => 1,
"bin-environment" =>
( "PHP_FCGI_CHILDREN" => "2",
"PHP_FCGI_MAX_REQUESTS" => "1000" )
)
)
)
EOF
Press ENTER
10 - Restart server
/opt/etc/init.d/S80lighttpd restart
11 - Go to 192.168.1.1:81/info.php and if you see this page, php is configured correctly
12 - Enable access 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
/jffs/scripts/firewall-start
/jffs/scripts/firewall-start
13 - Go to Port Forwarding page https://192.168.1.1/Advanced_VirtualServer_Content.asp and redirect port 80 to 81
Enjoy...
REVIEW (CLICK ON THE STARS TO RATE!)
5