server { server_name chat.mydomain.com; listen 8443 ssl; # external access listen 443 ssl; # internal access access_log /var/log/nginx/chat.mydomain.com_access_log main; error_log /var/log/nginx/chat.mydomain.com_error_log info; location / { root /data/daemons/conduwuit/element-web; } location ~ ^(/_matrix|/_synapse/client) { add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS, PATCH, HEAD'; proxy_pass http://127.0.0.1:6167; #proxy_pass http://127.0.0.1:6167$request_uri; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $host; proxy_buffering off; client_max_body_size 30M; proxy_read_timeout 10m; proxy_http_version 1.1; } location /.well-known/matrix/server { return 200 '{"m.server": "chat.mydomain.com:443"}'; types { } default_type "application/json; charset=utf-8"; } location /.well-known/matrix/client { return 200 '{"m.homeserver": {"base_url": "https://chat.mydomain.com"},"org.matrix.msc3575.proxy": {"url": "https://chat.mydomain.com"}}'; types { } default_type "application/json; charset=utf-8"; add_header "Access-Control-Allow-Origin" *; } }