1 (edytowany przez Regss 2018-06-01 10:10:37)

Temat: Gargoyle 1.10.0.3 - uhttpd nowa instancja

Witam.

Jestem początkujący. Próbuję dodać drugą instancję w uhttpd.
GUI przeniosłem na port 9999

Wykonałem:
# uci add uhttpd serv
# uci set uhttpd.@serv[-1].listen_http=0.0.0.0:80
# uci set uhttpd.@serv[-1].home=/www1
# uci commit uhttpd
# /etc/init.d/uhttpd restart

Jednak brak nasłuchiwania na tym porcie.

/etc/config/uhttpd wygląda:

config uhttpd 'main'
        option index_file 'login.sh'
        option index_page 'login.sh'
        option error_page '/login.sh'
        option no_dirlists '1'
        list listen_https '0.0.0.0:443'
        option home '/www'
        option rfc1918_filter '1'
        option max_requests '50'
        option max_connections '200'
        option cert '/etc/uhttpd.crt'
        option key '/etc/uhttpd.key'
        option cgi_prefix '/cgi-bin'
        list interpreter '.sh=/usr/bin/run_haserl'
        list interpreter '.csv=/usr/bin/run_haserl'
        option script_timeout '900'
        option network_timeout '30'
        option http_keepalive '20'
        option max_connections '200'
        option cert '/etc/uhttpd.crt'
        option key '/etc/uhttpd.key'
        option cgi_prefix '/cgi-bin'
        list interpreter '.sh=/usr/bin/run_haserl'
        list interpreter '.csv=/usr/bin/run_haserl'
        option script_timeout '900'
        option network_timeout '30'
        option http_keepalive '20'
        option tcp_keepalive '1'
        option listen_http '0.0.0.0:9999'

config serv
        option listen_http '0.0.0.0:80'
        option home '/www1'

netstat -nap

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:9999            0.0.0.0:*               LISTEN      12120/uhttpd
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1332/portmap
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      2820/dnsmasq
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1591/dropbear
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      12120/uhttpd
tcp        0    336 81.190.*.*:22       94.254.242.242:44802    ESTABLISHED 12288/dropbear
netstat: /proc/net/tcp6: No such file or directory
udp        0      0 0.0.0.0:53              0.0.0.0:*                           2820/dnsmasq
udp        0      0 0.0.0.0:67              0.0.0.0:*                           2820/dnsmasq
udp        0      0 0.0.0.0:111             0.0.0.0:*                           1332/portmap
udp        0      0 0.0.0.0:123             0.0.0.0:*                           1547/ntpd
udp        0      0 0.0.0.0:1194            0.0.0.0:*                           4918/openvpn
netstat: /proc/net/udp6: No such file or directory
netstat: /proc/net/raw6: No such file or directory
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node PID/Program name    Path
unix  10     [ ]         DGRAM                      1830 1286/logd           /dev/log
unix  2      [ ACC ]     STREAM     LISTENING        300 481/ubusd           /var/run/ubus.sock
unix  2      [ ]         DGRAM                      2754 1998/hostapd        /var/run/hostapd/wlan0
unix  2      [ ]         DGRAM                     27020 1/procd
unix  2      [ ]         DGRAM                      2654 1873/ddns_gargoyle
unix  3      [ ]         STREAM     CONNECTED       1833 481/ubusd           /var/run/ubus.sock
unix  2      [ ]         DGRAM                      4341 2820/dnsmasq
unix  3      [ ]         STREAM     CONNECTED       2063 481/ubusd           /var/run/ubus.sock
unix  2      [ ]         DGRAM                      2000 1332/portmap
unix  2      [ ]         DGRAM                      2331 1591/dropbear
unix  3      [ ]         STREAM     CONNECTED       2757 481/ubusd           /var/run/ubus.sock
unix  2      [ ]         DGRAM                      6921 4918/openvpn
unix  2      [ ]         DGRAM                      2434 1389/netifd
unix  3      [ ]         STREAM     CONNECTED       2756 1998/hostapd
unix  2      [ ]         DGRAM                     18396 1998/hostapd
unix  3      [ ]         STREAM     CONNECTED        311 481/ubusd           /var/run/ubus.sock
unix  2      [ ]         DGRAM                      2467 1389/netifd
unix  3      [ ]         STREAM     CONNECTED        310 1/procd
unix  3      [ ]         STREAM     CONNECTED       2062 1389/netifd
unix  3      [ ]         STREAM     CONNECTED       1832 1286/logd

2

Odp: Gargoyle 1.10.0.3 - uhttpd nowa instancja

config uhttpd serv , na taki sobie zmień.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

3 (edytowany przez Regss 2018-06-01 10:11:08)

Odp: Gargoyle 1.10.0.3 - uhttpd nowa instancja

Rozumiem, że wystarczy samo edytowanie configa + restart uhttpd.

Zmieniłem config jak poniżej. Próbowałem też z apostrofem 'serv'

po /etc/init.d/uhttpd restart dalej brak.

config uhttpd 'main'
        option index_file 'login.sh'
        option index_page 'login.sh'
        option error_page '/login.sh'
        option no_dirlists '1'
        list listen_https '0.0.0.0:443'
        option home '/www'
        option rfc1918_filter '1'
        option max_requests '50'
        option max_connections '200'
        option cert '/etc/uhttpd.crt'
        option key '/etc/uhttpd.key'
        option cgi_prefix '/cgi-bin'
        list interpreter '.sh=/usr/bin/run_haserl'
        list interpreter '.csv=/usr/bin/run_haserl'
        option script_timeout '900'
        option network_timeout '30'
        option http_keepalive '20'
        option tcp_keepalive '1'
        option listen_http '0.0.0.0:9999'

config uhttpd serv
        option listen_http '0.0.0.0:80'
        option home '/www1'
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:9999            0.0.0.0:*               LISTEN      12843/uhttpd
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1332/portmap
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      2820/dnsmasq
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1591/dropbear
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      12843/uhttpd
tcp        0    336 81.190.*.*:22       94.254.242.242:44800    ESTABLISHED 12541/dropbear
netstat: /proc/net/tcp6: No such file or directory
udp        0      0 0.0.0.0:53              0.0.0.0:*                           2820/dnsmasq
udp        0      0 0.0.0.0:67              0.0.0.0:*                           2820/dnsmasq
udp        0      0 0.0.0.0:111             0.0.0.0:*                           1332/portmap
udp        0      0 0.0.0.0:123             0.0.0.0:*                           1547/ntpd
udp        0      0 0.0.0.0:1194            0.0.0.0:*                           4918/openvpn
netstat: /proc/net/udp6: No such file or directory
netstat: /proc/net/raw6: No such file or directory
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node PID/Program name    Path
unix  9      [ ]         DGRAM                      1830 1286/logd           /dev/log
unix  2      [ ACC ]     STREAM     LISTENING        300 481/ubusd           /var/run/ubus.sock
unix  2      [ ]         DGRAM                      2754 1998/hostapd        /var/run/hostapd/wlan0
unix  2      [ ]         DGRAM                      2654 1873/ddns_gargoyle
unix  3      [ ]         STREAM     CONNECTED       1833 481/ubusd           /var/run/ubus.sock
unix  2      [ ]         DGRAM                      4341 2820/dnsmasq
unix  3      [ ]         STREAM     CONNECTED       2063 481/ubusd           /var/run/ubus.sock
unix  2      [ ]         DGRAM                      2000 1332/portmap
unix  2      [ ]         DGRAM                      2331 1591/dropbear
unix  3      [ ]         STREAM     CONNECTED       2757 481/ubusd           /var/run/ubus.sock
unix  2      [ ]         DGRAM                      6921 4918/openvpn
unix  2      [ ]         DGRAM                      2434 1389/netifd
unix  3      [ ]         STREAM     CONNECTED       2756 1998/hostapd
unix  2      [ ]         DGRAM                     18396 1998/hostapd
unix  3      [ ]         STREAM     CONNECTED        311 481/ubusd           /var/run/ubus.sock
unix  2      [ ]         DGRAM                      2467 1389/netifd
unix  3      [ ]         STREAM     CONNECTED        310 1/procd
unix  3      [ ]         STREAM     CONNECTED       2062 1389/netifd
unix  3      [ ]         STREAM     CONNECTED       1832 1286/logd

4

Odp: Gargoyle 1.10.0.3 - uhttpd nowa instancja

Na pewno zrobiłeś stop i start?

root@Gargoyle:~# uci show uhttpd
uhttpd.main=uhttpd
uhttpd.main.listen_http='0.0.0.0:8080'
uhttpd.main.index_file='login.sh'
uhttpd.main.index_page='login.sh'
uhttpd.main.error_page='/login.sh'
uhttpd.main.no_dirlists='1'
uhttpd.main.listen_https='0.0.0.0:443'
uhttpd.main.home='/www'
uhttpd.main.rfc1918_filter='1'
uhttpd.main.max_requests='50'
uhttpd.main.max_connections='200'
uhttpd.main.cert='/etc/uhttpd.crt'
uhttpd.main.key='/etc/uhttpd.key'
uhttpd.main.cgi_prefix='/cgi-bin'
uhttpd.main.interpreter='.sh=/usr/bin/run_haserl' '.csv=/usr/bin/run_haserl'
uhttpd.main.script_timeout='900'
uhttpd.main.network_timeout='30'
uhttpd.main.http_keepalive='20'
uhttpd.main.tcp_keepalive='1'
uhttpd.serv=uhttpd
uhttpd.serv.listen_http='0.0.0.0:80'
uhttpd.serv.home='/www1'
root@Gargoyle:~# netstat -apn | grep uhttp
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      4288/uhttpd
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      4287/uhttpd
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      4287/uhttpd
Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

5

Odp: Gargoyle 1.10.0.3 - uhttpd nowa instancja

Jak pisałem jestem początkujący, może o czymś zapomniałem.

Pownowny start i stop

root@Gargoyle:~# /etc/init.d/uhttpd stop
root@Gargoyle:~# /etc/init.d/uhttpd start
root@Gargoyle:~# uci show uhttpd
uhttpd.main=uhttpd
uhttpd.main.index_file='login.sh'
uhttpd.main.index_page='login.sh'
uhttpd.main.error_page='/login.sh'
uhttpd.main.no_dirlists='1'
uhttpd.main.listen_https='0.0.0.0:443'
uhttpd.main.home='/www'
uhttpd.main.rfc1918_filter='1'
uhttpd.main.max_requests='50'
uhttpd.main.max_connections='200'
uhttpd.main.cert='/etc/uhttpd.crt'
uhttpd.main.key='/etc/uhttpd.key'
uhttpd.main.cgi_prefix='/cgi-bin'
uhttpd.main.interpreter='.sh=/usr/bin/run_haserl' '.csv=/usr/bin/run_haserl'
uhttpd.main.script_timeout='900'
uhttpd.main.network_timeout='30'
uhttpd.main.http_keepalive='20'
uhttpd.main.tcp_keepalive='1'
uhttpd.main.listen_http='0.0.0.0:9999'
uhttpd.serv=uhttpd
uhttpd.serv.listen_http='0.0.0.0:80'
uhttpd.serv.home='/www1'
root@Gargoyle:~# netstat  -apn | grep uhttp
tcp        0      0 0.0.0.0:9999            0.0.0.0:*               LISTEN      13074/uhttpd
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      13074/uhttpd
netstat: /proc/net/tcp6: No such file or directory
netstat: /proc/net/udp6: No such file or directory
netstat: /proc/net/raw6: No such file or directory
root@Gargoyle:~#

6

Odp: Gargoyle 1.10.0.3 - uhttpd nowa instancja

Pokaż wynik logread

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

7 (edytowany przez Regss 2018-06-01 11:11:26)

Odp: Gargoyle 1.10.0.3 - uhttpd nowa instancja

Fri Jun  1 10:56:12 2018 daemon.err uhttpd[12651]: Error: Invalid directory /www1: No such file or directory

Mam zrobionego extroot'a. Czy to zmienia postać rzeczy?

root@Gargoyle:~# cd www1
root@Gargoyle:~/www1# ls
index.html
root@Gargoyle:~/www1#

8

Odp: Gargoyle 1.10.0.3 - uhttpd nowa instancja

Regss napisał/a:
Fri Jun  1 10:56:12 2018 daemon.err uhttpd[12651]: Error: Invalid directory /www1: No such file or directory

Mam zrobionego extroot'a. Czy to zmienia postać rzeczy?

root@Gargoyle:~# cd www1
root@Gargoyle:~/www1# ls
index.html
root@Gargoyle:~/www1#

/www1 to nie to samo co /root/www1

9

Odp: Gargoyle 1.10.0.3 - uhttpd nowa instancja

Czyli zrób /www1 a nie /root/www1 jak masz teraz.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

10

Odp: Gargoyle 1.10.0.3 - uhttpd nowa instancja

uhttp działa.

Doinstalowałem php5 oraz php5-cgi

Zmieniłem konfigurację uhttpd:
/etc/config/uhttpd

config uhttpd serv
        option listen_http '0.0.0.0:80'
        option home '/www1'
        option 'interpreter' '.php=/usr/bin/php-cgi'

/etc/php.ini:

; Paths and Directories

; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
doc_root = "/www1"
user_dir =
extension_dir = "/usr/lib/php"
enable_dl = On
;cgi.force_redirect = 1
;cgi.nph = 1
;cgi.redirect_status_env = ;
cgi.fix_pathinfo=1
;fastcgi.impersonate = 1;
;fastcgi.logging = 0
;cgi.rfc2616_headers = 0

Stworzyłem odpowiednio dwa pliki index.html oraz index.php
Wchodząc na index.html strona wyświetlana jest poprawnie.
Natomiast wchodząc na index.php otrzymuję:

Bad Gateway
The process did not produce any response

11

Odp: Gargoyle 1.10.0.3 - uhttpd nowa instancja

Zrób php-cgi /www1/index.php i zobacz co go boli.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

12

Odp: Gargoyle 1.10.0.3 - uhttpd nowa instancja

Segmentation fault

Próbowałem ustawić errors_log do pliku w php.ini ale nic nie zapisuje.
Jak to dalej debugować?

13

Odp: Gargoyle 1.10.0.3 - uhttpd nowa instancja

Wysypuje ci się po prostu php5. Zajrzyj na forum openwrt.org i na bugs.openwrt.org, poszukaj czy to jest znany problem i czy można coś z tym skonfigurować.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.