Hello!
I'm using this firmware:
Firmware Version OpenWRTYun Attitude Adjustment 1 / LuCI 0.11 Branch (0.11+svn10537)
Kernel Version 3.3.8
I want to configure it as captive portal, with an html page with some php scripts. I can configure the captive portal, and i can install php, but separately. If i try to do both things the board stops working and it resets itself completely. I show you the commands i used:
Note: i wrote w w w, h t t p, u h t t p d because the forum doesn't allow me to post link. Sorry for the inconvenience!
1) Install PHP:
opkg update
opkg install php5 php5-cgi php5-cli
vi /etc/config/u h t t p d
# Edit to uncomment the list interpreter php
/etc/init.d/u h t t p d restart
# PHP test
cd /mnt/sda1/arduino/w w w
echo "<?=phpinfo(); ?>" >phpinfo.php
Using the browser i can see the php page correctly.
2) Captive portal configuration:
uci set wireless.@wifi-iface[0].ssid='ArduinoWiFi'
uci add_list dhcp.@dnsmasq[0].address='/#/1.1.1.1'
uci add firewall redirect
uci set firewall.@redirect[-1].name=capture H T T P
uci set firewall.@redirect[-1].src=lan
uci set firewall.@redirect[-1].proto=tcp
uci set firewall.@redirect[-1].src_dip=!$(uci get network.lan.ipaddr)
uci set firewall.@redirect[-1].src_dport=80"
uci set firewall.@redirect[-1].dest_port=8080"
uci set firewall.@redirect[-1].dest_ip=$(uci get network.lan.ipaddr)
uci set firewall.@redirect[-1].target=DNAT
uci add firewall redirect
uci set firewall.@redirect[-1].name=captureDNS
uci set firewall.@redirect[-1].src=lan
uci set firewall.@redirect[-1].src_dip=!$(uci get network.lan.ipaddr)
uci set firewall.@redirect[-1].src_dport=53
uci set firewall.@redirect[-1].dest_port=53
uci set firewall.@redirect[-1].dest_ip=$(uci get network.lan.ipaddr)
uci set firewall.@redirect[-1].target=DNAT
echo >/etc/h t t p d_redirect.conf 'A:/:/cgi-bin/redirect.cgi'
cat >/w w w/cgi-bin/redirect.cgi <<EOM
#!/bin/sh
echo Status: 302 found
echo Location: h t t p://$(uci get network.lan.ipaddr)
echo Cache-Control: no-cache
echo
echo You are headed for h t t p ://$(uci get network.lan.ipaddr)
EOM
chmod +x /w w w/cgi-bin/redirect.cgi
uci set u h t t p d.redirect='u h t t p d'
uci set u h t t p d.redirect.listen_h t t p='0.0.0.0:8080'
uci set u h t t p d.redirect.cgi_prefix='/cgi-bin'
uci set u h t t p d.redirect.config='/etc/h t t p d_redirect.conf'
uci set u h t t p d.redirect.home='/w w w'
cat >/w w w/cgi-bin/control.cgi <<'EOM'
#!/bin/sh
echo $QUERY_STRING >/dev/ttyATH0
echo Cache-Control: no-cache
echo Content-type: text/plain
echo
echo Command sent
EOM
chmod +x /w w w/cgi-bin/control.cgi
uci commit
reboot -d 1 &
The page path is "/w w w/index.html". As i already said above, after reboot the board resets itself. Maybe there's some conflict between the two configurations. Can somebody help me?
Thanks.