
Ich versuche zu installierenjotterauf meinem Server und ich möchte Apache statt Nginx verwenden. DieInstallationsanleitunglistet nur eine Nginx-Konfigurationsdatei auf, die ich zu „übersetzen“ versuche.
Die Konfiguration besteht aus drei verschiedenen Proxy-Routen, von denen die erste zu einem Docker-Container führt, die zweite (/statisch/) in ein Verzeichnis mit Stylesheets und ähnlichem und das letzte in einen Unix-Domain-Socket.
In meinem Fall scheint die erste Route zu funktionieren (ich kann auf die Site zugreifen), aber jede Anfrage an eine statische Ressource gibt eine 404 zurück. Es sieht so aus, als ob jede Anfrage die Docker-Direktive ProxyPass verwendet (unabhängig von der Reihenfolge: wenn ich diese ans Ende setze (siehe unten), ist sie trotzdem die einzige, die verwendet wird).
Dies ist (ein Teil) der erstellten Protokolldatei:
yotter.domain.tld - - [12/Aug/2021:21:14:21 +0200] "GET /static/favicons/favicon.ico HTTP/1.1" 404 1935 file=proxy:http://127.0.0.1:5000/static/favicons/favicon.ico
yotter.domain.tld - - [12/Aug/2021:21:15:54 +0200] "GET /index HTTP/1.1" 200 1126 file=proxy:http://127.0.0.1:5000/index
yotter.domain.tld - - [12/Aug/2021:21:15:54 +0200] "GET /static/semantic/semantic.min.css HTTP/1.1" 404 1935 file=proxy:http://127.0.0.1:5000/static/semantic/semantic.min.css
Was könnte der Grund dafür sein?
Dies ist die Nginx-Konfiguration:
server {
listen 80;
server_name <example.com>; # ChangeME
access_log off;
location / {
proxy_pass http://127.0.0.1:5000;
proxy_http_version 1.1;
proxy_set_header Connection "";
}
location /static/ {
root /home/ubuntu/Yotter/app/; # Change this depending on where you clone Yotter
sendfile on;
aio threads=default;
}
location ~ (^/videoplayback$|/videoplayback/|/vi/|/a/) {
proxy_pass http://unix:/var/run/ytproxy/http-proxy.sock;
add_header Access-Control-Allow-Origin *;
sendfile on;
tcp_nopush on;
aio_write on;
aio threads=default;
directio 512;
proxy_http_version 1.1;
proxy_set_header Connection "";
}
}
Und hier ist, was ich bisher habe:
<VirtualHost *:443>
ServerName yotter.domain.tld
LogFormat "%v %l %u %t \"%r\" %>s %b file=%f" commonvhost
CustomLog ${APACHE_LOG_DIR}/yotter_access.log commonvhost
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/domain.tld/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.tld/privkey.pem
<Location "/">
ProxyPass http://127.0.0.1:5000/
ProxyPassReverse http://127.0.0.1:5000/
</Location>
<Location "/static">
Alias "/var/www/Yotter/app/static"
</Location>
<Directory "/var/www/Yotter/app/">
Require all granted
</Directory>
<LocationMatch (^/videoplayback$|/videoplayback/|/vi/|/a/)>
ProxyPass unix:///var/run/ytproxy/http-proxy.sock
ProxyPassReverse unix:///var/run/ytproxy/http-proxy.sock
Header add Acces-Control-Allow-Origin: *
</LocationMatch>
</VirtualHost>
oder
<VirtualHost *:443>
ServerName yotter.domain.tld
LogFormat "%v %l %u %t \"%r\" %>s %b file=%f" commonvhost
CustomLog ${APACHE_LOG_DIR}/yotter_access.log commonvhost
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/domain.tld/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.tld/privkey.pem
Alias "/static" "/var/www/Yotter/app/static"
<Directory "/var/www/Yotter/app/">
Require all granted
</Directory>
<LocationMatch (^/videoplayback$|/videoplayback/|/vi/|/a/)>
ProxyPass unix:///var/run/ytproxy/http-proxy.sock
ProxyPassReverse unix:///var/run/ytproxy/http-proxy.sock
Header add Acces-Control-Allow-Origin: *
</LocationMatch>
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
</VirtualHost>
Antwort1
Sie müssen Statistiken vom Proxying ausschließen mit !
:
ProxyPass "/static" "!"
Dies sollte vor den Proxy-Befehlen in der Konfiguration erscheinen.
Oder:
<Location "/static">
ProxyPass "!"
</Location>
Siehe auchOffizielle ProxyPass-Dokumentation.