Reverse Proxy for Rocket.Chat

rocketchat.conf
# Upstreams
upstream backend {
    server 127.0.0.1:3000;
}
 
# HTTPS Server
server {
    server_name chat.kalenpw.com;
 
    # You can increase the limit if your need to.
    client_max_body_size 200M;
 
    error_log /var/log/nginx/rocketchat.access.log;
 
    location / {
        proxy_pass http://backend/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;
 
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forward-Proto http;
        proxy_set_header X-Nginx-Proxy true;
 
        proxy_redirect off;
    }
 
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/wiki.kalen.pw-0001/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/wiki.kalen.pw-0001/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
 
}
 
server {
    if ($host = chat.kalenpw.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
 
 
    listen 80;
    server_name chat.kalenpw.com;
    return 404; # managed by Certbot
}