I can’t get Rocket.Chat to run properly in a sub folder on Apache.
With this configuration in example.conf:
<VirtualHost *:80>
....
# Redirect Requests to SSL
Redirect permanent / https://example.com
....
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
....
ServerName example.com
ServerAlias example.com
DocumentRoot /var/www/html/example/
....
<Location /chat>
Order allow,deny
Allow from all
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /var/www/html/example/(.*) ws://localhost:3000/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /var/www/html/example/(.*) http://localhost:3000/$1 [P,L]
ProxyPassReverse http://localhost:3000
</Location>
....
</VirtualHost>
</IfModule>
And this configuration in rocketchat.service:
MONGO_URL=mongodb://localhost:27017/rocketchat
ROOT_URL=http://example.com:3000
PORT=3000
I get a Rocket.Chat page (https://example.com/chat) but nothing works and I have this in my console
GET https://example.com/1b0d8599411c1e4f1919893c25d81fc7ac20d65b.css?meteor_css_resource=true net::ERR_ABORTED 404 (Not Found)
chat:200 GET https://example.com/theme.css?1807b422d007328786a00d34e6c63ee6022dd2b3 net::ERR_ABORTED 404 (Not Found)
chat:1138 GET https://example.com/6a61dfe05b23fcb695eea8e15f15c745e2623326.js?meteor_js_resource=true net::ERR_ABORTED 404 (Not Found)
As you can see, there’s no subfolder “chat/” in the url’s.
And when I put in rocketchat.service
ROOT_URL=https://example.com/chat/ node main.js
I get :
503 Service Unavailable
And in the Apache error log :
Fri Nov 09 16:21:16.460766 2018] [proxy_http:error] [pid 5999] [client 72.56.75.46:52090] AH01114: HTTP: failed to make connection to backend: localhost
I’m lost, I don’t understand what I’m doing wrong.