I have installed the Awsome Rocket.Chat on Ubuntu 16.04 using Snap, however i can no figure out how to change the server from running on http://DOMAIN:3000 to simply http://DOMAIN ..
Thanks
I have installed the Awsome Rocket.Chat on Ubuntu 16.04 using Snap, however i can no figure out how to change the server from running on http://DOMAIN:3000 to simply http://DOMAIN ..
Thanks
Currently the Rocket.Chat snap doesn't have the option to change the port its listening on. In the near future we will be adding support for this, as well as to add ssl.
But for now our suggestion would be to use a reverse proxy like nginx in front of the snap.
If you decide to use nginx you can do the following:
Install nginx: sudo apt install nginx
Then edit /etc/nginx/sites-enabled/default
with your favorite editor
and put the following contents in it:
# Upstreams
upstream backend {
server 127.0.0.1:3000;
}
# HTTPS Server
server {
listen 443;
server_name your-domain.com;
error_log /var/log/nginx/rocketchat.access.log;
ssl on;
ssl_certificate /etc/nginx/certificate.crt;
ssl_certificate_key /etc/nginx/certificate.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # don’t use SSLv3 ref: POODLE
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-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forward-Proto http;
proxy_set_header X-Nginx-Proxy true;
proxy_redirect off;
}
}
Replacing your-domain.com
with your domain.
Once you save then restart nginx: sudo services nginx restart
You can define a rule in iptables
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 3000
and then save the rule by this command
sudo apt-get install iptables-persistent
The documentation states :
Starting from release 0.73, it is possible to configure these environmental variables through snap hooks like this:
sudo snap set rocketchat-server port=<another-port>
sudo snap set rocketchat-server mongo-url=mongodb://<your-url>:<your-port>/<your-db-name>
sudo snap set rocketchat-server mongo-oplog-url=mongodb://<your-url>:<your-port>/local
Remember to restart rocket.chat service after setting new values:
sudo systemctl restart snap.rocketchat-server.rocketchat-server.service
This method worked for me.
root@sathish:/snap/rocketchat-server/580/bin# sudo snap run rocketchat-server.initcaddy
Replace /var/snap/rocketchat-server/580/Caddyfile with your own to customize reverse proxy
Edit the file
/var/snap/rocketchat-server/580/Caddyfile
Replace :8080 to :80
http://yourdomain:80
proxy / localhost:3000 {
websocket
transparent
}
Restart the service
sudo systemctl restart snap.rocketchat-server.rocketchat-caddy
Check the Port for confirmation
netstat -plnatu | grep :80