98 lines
2.7 KiB
Plaintext
98 lines
2.7 KiB
Plaintext
add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
|
|
|
|
# Upstream with keepalive for Matrix
|
|
upstream matrix_backend {
|
|
server 10.0.0.48:8008;
|
|
keepalive 32;
|
|
keepalive_requests 1000;
|
|
keepalive_timeout 60s;
|
|
}
|
|
|
|
# Redirect HTTP to HTTPS
|
|
server {
|
|
listen 10.0.0.29:80;
|
|
server_name matrix.egonetix.de;
|
|
return 301 https://$server_name$request_uri;
|
|
}
|
|
|
|
# HTTPS for client traffic (port 443)
|
|
server {
|
|
listen 10.0.0.29:443 ssl http2;
|
|
server_name matrix.egonetix.de;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/matrix.egonetix.de/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/matrix.egonetix.de/privkey.pem;
|
|
ssl_dhparam /etc/ssl/certs/dhparam.pem;
|
|
|
|
access_log /var/log/nginx/matrix-access.log;
|
|
error_log /var/log/nginx/matrix-error.log;
|
|
|
|
# Gzip compression
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_proxied any;
|
|
gzip_comp_level 5;
|
|
gzip_types text/plain text/css text/xml text/javascript
|
|
application/json application/javascript application/xml+rss;
|
|
gzip_min_length 1000;
|
|
|
|
set $upstream 10.0.0.48;
|
|
|
|
location ~ ^(/_matrix|/_synapse/client) {
|
|
proxy_pass http://matrix_backend;
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header Host $host;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection "";
|
|
|
|
# Better buffering for Matrix
|
|
proxy_buffering on;
|
|
proxy_buffer_size 8k;
|
|
proxy_buffers 32 8k;
|
|
|
|
client_max_body_size 50M;
|
|
}
|
|
}
|
|
|
|
# HTTPS for federation traffic (port 8448)
|
|
server {
|
|
listen 10.0.0.29:8448 ssl http2;
|
|
server_name matrix.egonetix.de;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/matrix.egonetix.de/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/matrix.egonetix.de/privkey.pem;
|
|
ssl_dhparam /etc/ssl/certs/dhparam.pem;
|
|
|
|
access_log /var/log/nginx/matrix-access.log;
|
|
error_log /var/log/nginx/matrix-error.log;
|
|
|
|
# Gzip compression
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_proxied any;
|
|
gzip_comp_level 5;
|
|
gzip_types text/plain text/css text/xml text/javascript
|
|
application/json application/javascript application/xml+rss;
|
|
gzip_min_length 1000;
|
|
|
|
set $upstream 10.0.0.48;
|
|
|
|
location ~ ^(/_matrix|/_synapse/client) {
|
|
proxy_pass http://matrix_backend;
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header Host $host;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection "";
|
|
|
|
# Better buffering for Matrix
|
|
proxy_buffering on;
|
|
proxy_buffer_size 8k;
|
|
proxy_buffers 32 8k;
|
|
|
|
client_max_body_size 50M;
|
|
}
|
|
}
|
|
|