Ubuntu Apache Subdomain ProxyReverse Error

Description

Server Setup Information

  • Version of Rocket.Chat Server:3.12.13
  • Operating System: Ubuntu 20.04
  • Deployment Method: manual
  • Number of Running Instances: 1
  • DB Replicaset Oplog:
  • NodeJS Version: 12.18.4
  • MongoDB Version: 4.0.23
  • Proxy: apache
  • Firewalls involved: none

Any additional Information

Hi guys. Can somebody point me to the right direction?
I’m new with rocketchat, but willing to learn.

  1. I followed the manual installation on the rocketchat website
  2. This is the content of my port 80 virtualhost
    <VirtualHost *:80>
    DocumentRoot /var/www/html/chat.mydomain/
    ServerName chat.mydomain
    ServerAlias www.chat.mydomain

<Directory /var/www/html/chat.mydomain/>
Options FollowSymlinks
AllowOverride All
Require all granted

ErrorLog {APACHE_LOG_DIR}/error.log CustomLog {APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =chat.mydomain [OR]
RewriteCond %{SERVER_NAME} =www.chat.mydomain
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

  1. This is the content of my port 443 virtualhost

    <VirtualHost :443>
    ServerName chat.mydomain
    LogLevel debug
    ErrorLog /var/log/chat.mydomain_error.log
    TransferLog /var/log/chat.mydomain_access.log

    Require all granted

    RewriteEngine On
    RewriteCond %{HTTP:Upgrade} =websocket [NC]
    RewriteRule /(.
    ) ws://localhost:3000/$1 [P,L]
    RewriteCond %{HTTP:Upgrade} !=websocket [NC]
    RewriteRule /(.*) http://localhost:3000/$1 [P,L]

    ProxyPassReverse / http://localhost:3000/
    SSLEngine On
    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/mydomain/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/mydomain/privkey.pem

  2. This is the content of my rocketchat service
    [Unit]
    Description=The Rocket.Chat server
    #After=network.target remote-fs.target nss-lookup.target nginx.service mongod.service
    After=network.target remote-fs.target nss-lookup.target apache2.service mongod.service
    [Service]
    ExecStart=/usr/local/bin/node /opt/Rocket.Chat/main.js
    StandardOutput=syslog
    StandardError=syslog
    SyslogIdentifier=rocketchat
    User=rocketchat
    #Environment=MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01 MONGO_OPLOG_URL=mongodb://localhost:2701>
    Environment=MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01
    Environment=MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01
    Environment=ROOT_URL=https://chat.mydomain/
    Environment=HTTP_FORWARDED_COUNT=1
    [Install]
    WantedBy=multi-user.target

  3. This is the error I get from the page

Service Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
Apache/2.4.41 (Ubuntu) Server at chat.mydomain Port 443

  1. This is what I get in the log files

My questions.
1.There is a comment to include Environment=HTTP_FORWARDED_COUNT=1 in the rocketchat file for a proxy. I did that. Is that what the instructions want?
2. In my virtualhost port 443 I have the Let’s Encrypt certificates. Notice that I do not have any intermediate one, but according to the logs this does not appear to be a problem. Or it is?
3. The errors are toward the end of the logs and seems related to the proxy_fcgi and proxy_http.
How should I go about solving them?

Thank you guys.