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:

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>

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


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" : "",
        "public" : true,
        "sorter" : 1,
        "ts" : ISODate("2018-08-22T15:27:46.449Z"),
        "type" : "string",
        "value" : "",
        "valueSource" : "packageValue"

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

Description=The Rocket.Chat server
ExecStart=/usr/bin/node /opt/Rocket.Chat/main.js

Ok, this is maybe not the solution you want to hear, but why aren’t you simply using a subdomain like ? 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…


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!