1 - Install Entware from here
2 - Update entware
opkg upgrade
3 - Install nginx and php
4 - Backup default configuration file
5 - Create nginx configuration file, copy/paste in terminal:
user nobody;
worker_processes 1;
events {
worker_connections 64;
}
http {
include mime.types;
include /opt/etc/nginx/sites-enabled/*;
include /opt/etc/nginx/conf.d/*.conf;
default_type application/octet-stream;
server {
listen 82;
server_name localhost;
location / {
root /opt/share/nginx/html;
index index.php index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /opt/share/nginx/html/50x.html {
root html;
}
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
root /opt/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
EOF
Press Enter
6 - Create php-cgi startup script
#!/bin/sh
ENABLED=yes
PROCS=php-cgi
ARGS="-b 127.0.0.1:9000"
PREARGS="/usr/bin/env PHP_FCGI_CHILDREN=2 PHP_FCGI_MAX_REQUESTS=1000"
DESC=$PROCS
PATH=/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
. /opt/etc/init.d/rc.func
EOF
Press Enter
7 - Make script executable
8 - Fix php doc_root for nginx
doc_root = "/opt/share/nginx/html"|g' "/opt/etc/php.ini"
9 - Start server
/opt/etc/init.d/S80php-cgi start
10 - Go to 192.168.1.1:82 and if you see this page, the nginx web server is configured correctly
11 - Create php info page:
<?php
phpinfo();
?>
EOF
Press Enter
12 - Go to 192.168.1.1:82/info.php and if you see this page, php is configured correctly
ACCESS THE WEBSITE FROM WAN
Paste this lines
#!/bin/sh
iptables -I INPUT -p tcp --destination-port 82 -j ACCEPT
sh /jffs/scripts/firewall-start
Go to Port Forwarding page https://192.168.1.1/Advanced_VirtualServer_Content.asp and redirect port 80 to 82, now you should have access from wan.