FHEM Forum

FHEM => Frontends => TabletUI => Thema gestartet von: aeronaut am 11 Dezember 2020, 16:52:05

Titel: FTUI über Apache laufen lassen
Beitrag von: aeronaut am 11 Dezember 2020, 16:52:05
Hi,

FTUI ist erreichbar und funktionstüchtig unter http://192.168.10.82:8083/fhem/tablet/index.html

Nun möchte ich es über einen Apache unter http://192.168.10.82/fhem erreichbar haben. Also nach diesem Vorbild die Apache-Config angepasst: https://forum.fhem.de/index.php/topic,78156.msg701882.html#msg701882 (https://forum.fhem.de/index.php/topic,78156.msg701882.html#msg701882):
<VirtualHost 192.168.10.82:80>

    ServerAdmin webmaster@localhost
    DocumentRoot /opt/fhem/www/tablet

    <Directory /opt/fhem/www/tablet>
        Order allow,deny
        Allow from all
        Require all granted

        Options +Indexes
    </Directory>
    LogLevel alert rewrite:trace2
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
<Location /fhem>

  RewriteEngine On
    ProxyPass http://localhost:8083/fhem/tablet/
    ProxyPassReverse http://localhost:8083/fhem/tablet

</Location>
</VirtualHost>


Der Aufruf von http://192.168.10.82/fhem/ bringt HTTP Status 500 - Internal Server Error

Apache access.log:
192.168.10.21 - - [11/Dec/2020:16:45:47 +0100] "GET /fhem/ HTTP/1.1" 500 803 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0"
192.168.10.21 - - [11/Dec/2020:16:45:47 +0100] "GET /favicon.ico HTTP/1.1" 403 495 "http://192.168.10.82/fhem/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0"


Apache error.log:
[Fri Dec 11 16:45:47.746138 2020] [rewrite:trace2] [pid 2899] mod_rewrite.c(483): [client 192.168.10.21:51378] 192.168.10.21 - - [192.168.10.82/sid#ffff816c0110][rid#ffff843540a0/initial] init rewrite engine with requested uri /fhem/
[Fri Dec 11 16:45:47.746314 2020] [rewrite:trace1] [pid 2899] mod_rewrite.c(483): [client 192.168.10.21:51378] 192.168.10.21 - - [192.168.10.82/sid#ffff816c0110][rid#ffff843540a0/initial] pass through /fhem/
[Fri Dec 11 16:45:47.746434 2020] [rewrite:trace1] [pid 2899] mod_rewrite.c(483): [client 192.168.10.21:51378] 192.168.10.21 - - [192.168.10.82/sid#ffff816c0110][rid#ffff843540a0/initial] [perdir /fhem/] pass through proxy:http://localhost:8083/fhem/tablet//


Reichlich wenig Fleisch in den Logs  :-\  woran könnte das liegen?

lg
aeronaut
Titel: Antw:FTUI über Apache laufen lassen
Beitrag von: amenomade am 11 Dezember 2020, 21:38:52
"/" am Ende immer kohärent halten.

Wenn Du Location /fhem (ohen Slash am Ende) nach ...fhem/tablet/ (mit Slash am Ende) proxiest, dann wird eine URL ...fhem/xxx zu ...fhem/tablet//xxx übersetzt. Das Doppelslash sieht man sogar in deiner ErrorLog.

EDIT: im von dir hieroben verlinkten Post ist es korrekt eingestellt. Schau mal nach.
Titel: Antw:FTUI über Apache laufen lassen
Beitrag von: aeronaut am 11 Dezember 2020, 21:57:53
Habe den / entfernt, leider bringt das nichts.

Der Proxy sieht nun so aus:
<Location /fhem>

    RewriteEngine On
    ProxyPass http://localhost:8083/fhem/tablet
    ProxyPassReverse http://localhost:8083/fhem/tablet

</Location>


error.log:
[Fri Dec 11 21:54:43.109923 2020] [rewrite:trace2] [pid 14968] mod_rewrite.c(483): [client 192.168.10.21:54106] 192.168.10.21 - - [192.168.10.82/sid#ffffa1d95168][rid#ffffa4a150a0/initial] init rewrite engine with requested uri /fhem
[Fri Dec 11 21:54:43.110120 2020] [rewrite:trace1] [pid 14968] mod_rewrite.c(483): [client 192.168.10.21:54106] 192.168.10.21 - - [192.168.10.82/sid#ffffa1d95168][rid#ffffa4a150a0/initial] pass through /fhem
[Fri Dec 11 21:54:43.110267 2020] [rewrite:trace1] [pid 14968] mod_rewrite.c(483): [client 192.168.10.21:54106] 192.168.10.21 - - [192.168.10.82/sid#ffffa1d95168][rid#ffffa4a150a0/initial] [perdir /fhem/] pass through proxy:http://localhost:8083/fhem/tablet
Titel: Antw:FTUI über Apache laufen lassen
Beitrag von: aeronaut am 11 Dezember 2020, 21:59:31
Gerade ist mir aufgefallen, dass bei Eingabe von http://192.168.10.82:8083/fhem/tablet in FHEM lande, aber bei http://192.168.10.82:8083/fhem/tablet/index.html in FTUI lande ...  :o
Titel: Antw:FTUI über Apache laufen lassen
Beitrag von: amenomade am 11 Dezember 2020, 22:01:44
Hast Du apache "gracefully" (oder sogar komplett) neu gestartet?
EDIT: ja, sieht so aus
Titel: Antw:FTUI über Apache laufen lassen
Beitrag von: aeronaut am 11 Dezember 2020, 22:04:11
Habe ihn neu gestartet mit systemctl restart
Titel: Antw:FTUI über Apache laufen lassen
Beitrag von: amenomade am 11 Dezember 2020, 22:07:45
Dein Virtualhost läuft auf Port 80

http://192.168.10.82/fhem
Titel: Antw:FTUI über Apache laufen lassen
Beitrag von: aeronaut am 11 Dezember 2020, 22:13:10
Das ist mir klar. Ich hatte kurz überlegt, ob die Angabe der index.html damit was zu tun hat. Hier ist beschrieben, dass sie bei Benutzung über WEB angegeben werden muss: https://wiki.fhem.de/wiki/FHEM_Tablet_UI

Der Apache wirft weiterhin den 500, egal ob mit oder ohne index.html
Titel: Antw:FTUI über Apache laufen lassen
Beitrag von: amenomade am 11 Dezember 2020, 22:19:17
Und was sagen jetzt genau die Logs (auch Fhem Log)?
Titel: Antw:FTUI über Apache laufen lassen
Beitrag von: aeronaut am 11 Dezember 2020, 22:32:45
Nichts neues bei Apache:
[Fri Dec 11 22:23:02.171579 2020] [rewrite:trace2] [pid 2823] mod_rewrite.c(483): [client 192.168.10.21:64680] 192.168.10.21 - - [192.168.10.82/sid#ffff906ef168][rid#ffff9336f0a0/initial] init rewrite engine with requested uri /fhem
[Fri Dec 11 22:23:02.171771 2020] [rewrite:trace1] [pid 2823] mod_rewrite.c(483): [client 192.168.10.21:64680] 192.168.10.21 - - [192.168.10.82/sid#ffff906ef168][rid#ffff9336f0a0/initial] pass through /fhem
[Fri Dec 11 22:23:02.171915 2020] [rewrite:trace1] [pid 2823] mod_rewrite.c(483): [client 192.168.10.21:64680] 192.168.10.21 - - [192.168.10.82/sid#ffff906ef168][rid#ffff9336f0a0/initial] [perdir /fhem/] pass through proxy:http://localhost:8083/fhem/tablet


Aber bei fhem:
2020.12.11 22:23:48 3: FHEMWEB WEB CSRF error: csrf_16886882175852 ne csrf_58045058297708 for client WEB_192.168.10.21_64253 / command jsonlist2 GartenLicht STATE. For details see the csrfToken FHEMWEB attribute.

Habe jetzt das Attribut csrfToken auf none gesetzt. Damit verschwinden die Einträge im fhem.log, aber der 500er kommt noch immer.
Titel: Antw:FTUI über Apache laufen lassen
Beitrag von: amenomade am 11 Dezember 2020, 23:16:26
Hmm. Langsam bin ich ratlos.

Versuch mal LogLevel auf "debug rewrite:trace2" zu setzen. Vielleicht sieht man da mehr.
Titel: Antw:FTUI über Apache laufen lassen
Beitrag von: aeronaut am 11 Dezember 2020, 23:25:06
Das war eine gute Idee:
[Fri Dec 11 23:21:38.193823 2020] [rewrite:trace1] [pid 3486] mod_rewrite.c(483): [client 192.168.10.21:57283] 192.168.10.21 - - [192.168.10.82/sid#ffff8aa0a168][rid#ffff8d68a0a0/initial] pass through /fhem
[Fri Dec 11 23:21:38.193940 2020] [authz_core:debug] [pid 3486] mod_authz_core.c(843): [client 192.168.10.21:57283] AH01628: authorization result: granted (no directives)
[Fri Dec 11 23:21:38.194049 2020] [rewrite:trace1] [pid 3486] mod_rewrite.c(483): [client 192.168.10.21:57283] 192.168.10.21 - - [192.168.10.82/sid#ffff8aa0a168][rid#ffff8d68a0a0/initial] [perdir /fhem/] pass through proxy:http://localhost:8083/fhem/tablet
[Fri Dec 11 23:21:38.194163 2020] [proxy:debug] [pid 3486] mod_proxy.c(1251): [client 192.168.10.21:57283] AH01143: Running scheme http handler (attempt 0)
[Fri Dec 11 23:21:38.194213 2020] [proxy_fcgi:debug] [pid 3486] mod_proxy_fcgi.c(1030): [client 192.168.10.21:57283] AH01076: url: http://localhost:8083/fhem/tablet proxyname: (null) proxyport: 0
[Fri Dec 11 23:21:38.194309 2020] [proxy_fcgi:debug] [pid 3486] mod_proxy_fcgi.c(1035): [client 192.168.10.21:57283] AH01077: declining URL http://localhost:8083/fhem/tablet
[Fri Dec 11 23:21:38.194355 2020] [proxy_wstunnel:debug] [pid 3486] mod_proxy_wstunnel.c(304): [client 192.168.10.21:57283] AH02450: declining URL http://localhost:8083/fhem/tablet
[Fri Dec 11 23:21:38.194395 2020] [proxy:warn] [pid 3486] [client 192.168.10.21:57283] AH01144: No protocol handler was valid for the URL /fhem (scheme 'http'). If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.


Scheinbar fehlt beim mod_proxy irgendwas ....
Titel: Antw:FTUI über Apache laufen lassen
Beitrag von: aeronaut am 11 Dezember 2020, 23:54:48
Es funktioniert so:

ProxyPass http://localhost:8083/fhem/tablet/
    ProxyPassReverse http://localhost:8083/fhem/tablet/


Scheinbar werden die abschließenden Schrägstriche vom proxy-Modul benötigt.

Danke  :D
Titel: Antw:FTUI über Apache laufen lassen
Beitrag von: amenomade am 12 Dezember 2020, 00:02:06
Wie sieht jetzt die gesamte Apache config aus?
Titel: Antw:FTUI über Apache laufen lassen
Beitrag von: aeronaut am 12 Dezember 2020, 10:56:37
Die apache2.conf ist unangetastet. Die ftui.conf:
<VirtualHost 192.168.10.82:80>

    ServerAdmin webmaster@localhost
    DocumentRoot /opt/fhem/www/tablet

    <Directory /opt/fhem/www/tablet>
        Order allow,deny
        Allow from all
        Require all granted

        Options +Indexes
    </Directory>
    LogLevel debug rewrite:trace2
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
<Location /fhem>

    RewriteEngine On
    ProxyPass http://localhost:8083/fhem/tablet/
    ProxyPassReverse http://localhost:8083/fhem/tablet/

</Location>
</VirtualHost>


Es gibt aber Merkwürdigkeiten:
Unter http://192.168.10.82/ ist FTUI ebenfalls erreichbar. Das sollte so nicht sein, bzw. sagt die Config das gar nicht aus. Und von dort wird auch PHP interpretiert. Der Aufruf von http://192.168.10.82/fhem/index.php startet den Download der php-Datei.
Titel: Antw:FTUI über Apache laufen lassen
Beitrag von: amenomade am 12 Dezember 2020, 11:18:56
Hast Du andere .conf Dateien in conf-enabled?
Titel: Antw:FTUI über Apache laufen lassen
Beitrag von: aeronaut am 12 Dezember 2020, 11:30:21
ls /etc/apache2/conf-available/ -al
total 32
drwxr-xr-x 2 root root 4096 Dec 12 11:13 .
drwxr-xr-x 8 root root 4096 Dec 12 11:15 ..
-rw-r--r-- 1 root root  315 Mar  5  2020 charset.conf
-rw-r--r-- 1 root root 3224 Mar  5  2020 localized-error-pages.conf
-rw-r--r-- 1 root root  189 Mar  5  2020 other-vhosts-access-log.conf
-rw-r--r-- 1 root root  804 Nov 27 13:26 php8.0-fpm.conf
-rw-r--r-- 1 root root 2174 Mar  5  2020 security.conf
-rw-r--r-- 1 root root  455 Mar  5  2020 serve-cgi-bin.conf


und die sind alle als Symlink enabled und unverändert. Muss dort ggf. etwas für den vhost eingetragen werden?

Alle VHosts:
apache2ctl -S
VirtualHost configuration:
192.168.10.82:80       homeserver (/etc/apache2/sites-enabled/001-ftui.conf:1)
*:80                   homeserver (/etc/apache2/sites-enabled/000-default.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex fcgid-pipe: using_defaults
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex fcgid-proctbl: using_defaults
Mutex proxy: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33


apachectl -D DUMP_MODULES
Loaded Modules:
core_module (static)
so_module (static)
watchdog_module (static)
http_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
unixd_module (static)
access_compat_module (shared)
alias_module (shared)
auth_basic_module (shared)
authn_core_module (shared)
authn_file_module (shared)
authz_core_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
fcgid_module (shared)
filter_module (shared)
mime_module (shared)
mpm_prefork_module (shared)
negotiation_module (shared)
php_module (shared)
proxy_module (shared)
proxy_fcgi_module (shared)
proxy_http_module (shared)
proxy_wstunnel_module (shared)
reqtimeout_module (shared)
rewrite_module (shared)
setenvif_module (shared)
status_module (shared)


PHP ist geladen ... hm
Titel: Antw:FTUI über Apache laufen lassen
Beitrag von: amenomade am 12 Dezember 2020, 11:48:12
Dann müsstest Du gucken, ob z.B. php8.conf aber im allgemein alle .conf auch auf den gleichen Adressen und Ports und ggf Locations greifen.