Rocket.Chat in Apache subdir not working

Hello everyone,

unfortunately I will need some help after some ( more like 50… ) tries. I am not able, by any means to configure RocketChat to be available in subdirectory. HELP IS GREATLY APPRECIATED!

I either get a blank page or 404 not found (Rocket chats message).

I have followed this guide: https://rocket.chat/docs/installation/manual-installation/running-in-a-sub-folder/

But it didn’t help, or I might have not understood correctly, but either way, it does not work.

Here is my Apache config (I’ve been messing with rewrite paths but I can’t get it right):

<VirtualHost BLABLA>

ServerName mypage.com
ServerAdmin admin@page.com
DocumentRoot /var/www/html/page #there is my main page

ErrorLog /var/log/rror.log
TransferLog /var/log/access.log
LogLevel info

Location /chat>
    Order allow,deny
    Allow from all

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

    ProxyPassReverse http://localhost:8080
</Location>

<VirtualHost>

Settings in mongo;

> use rocketchat
switched to db rocketchat
> db.rocketchat_settings.find({ "_id" : "Site_Url"}).pretty()
{
        "_id" : "Site_Url",
        "_updatedAt" : ISODate("2018-08-22T15:27:46.449Z"),
        "autocomplete" : true,
        "blocked" : false,
        "createdAt" : ISODate("2018-08-21T17:31:46.319Z"),
        "group" : "General",
        "hidden" : false,
        "i18nDescription" : "Site_Url_Description",
        "i18nLabel" : "Site_Url",
        "packageValue" : "https://mypage.com/chat/",
        "public" : true,
        "sorter" : 1,
        "ts" : ISODate("2018-08-22T15:27:46.449Z"),
        "type" : "string",
        "value" : "https://mypage.com/chat/",
        "valueSource" : "packageValue"
}

Systemd unit file (I have tried different settings…):

[Unit]
Description=The Rocket.Chat server
After=network.target remote-fs.target nss-lookup.target mongod.target
[Service]
ExecStart=/usr/bin/node /opt/Rocket.Chat/main.js
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rocketchat
User=root
Environment=MONGO_URL=mongodb://localhost:27017/rocketchat
Environment=ROOT_URL=https://mypage.com/chat/
Environment=PORT=8080
[Install]
WantedBy=multi-user.target

Ok, this is maybe not the solution you want to hear, but why aren’t you simply using a subdomain like https://chat.mypage.com ? That way installation should be a lot easier.

You could still work with the chat subdir and redirect it to the subdomain.

Just my two cents…

Stef

Well, that seriously didn’t even cross my mind and now I feel stupid. This is the most obvious way to approach this. Thank you very much.

It doesn’t matter. Sometimes you are focussed on the problem too much and less on the solution. I am a RC starter too so I stumbled on a lot of problems myself too.

Have fun!

Stef