Nextcloud-App/extra/element-web-nginx.conf

69 lines
1.8 KiB
Plaintext

server {
listen 8080;
listen [::]:8080;
server_name localhost;
root /var/empty;
index index.html;
log_not_found on;
access_log /dev/stderr combined;
error_log /dev/stderr info;
location /upschooling/element-web {
rewrite ^/upschooling/element-web/(.*)$ /$1 break;
proxy_set_header Host localhost:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass "http://127.0.0.1:8082";
}
location /.well-known/matrix {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods GET;
default_type application/json;
# TODO: Add missing matrix well-known files
proxy_set_header Host localhost:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_redirect http://localhost:8008/.well-known/matrix http://localhost:8080/.well-known/matrix;
proxy_pass "http://127.0.0.1:8008$request_uri";
}
location / {
proxy_set_header Host localhost:8080;
proxy_pass "http://127.0.0.1:80$request_uri";
}
}
server {
listen 8082;
listen [::]:8082;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
set_real_ip_from 127.0.0.1;
set_real_ip_from ::1;
# Set no-cache for the version, config and index.html
# so that browsers always check for a new copy of Element Web.
# NB http://your-domain/ and http://your-domain/? are also covered by this
location = /index.html {
add_header Cache-Control "no-cache";
}
location = /version {
add_header Cache-Control "no-cache";
}
# covers config.json and config.hostname.json requests as it is prefix.
location /config {
add_header Cache-Control "no-cache";
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
}