我正在尝试将NGINX配置为反向代理以使用RocketChat服务,但该服务未加载到所需的位置。服务(RocketChat)运行的输入端口是2357,而它应该运行的输出端口是端口3000。有人能帮我解决这个问题吗?
Code for the location on which RocketChat should load
我还添加了docker-compose映像基础结构以供参考。
Docker Image Details
nginx.conf文件:
location ^~ /chat {
client_max_body_size 200m;
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-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Nginx-Proxy true;
proxy_redirect off;
proxy_pass http://rocketchat:3000/;
}
docker-compose-org.yml:
# Image--infrastructure:rocketchat
rocketchat:
image: rocketchat/rocket.chat:latest
hostname: rocketchat
command: >
bash -c
"for i in `seq 1 30`; do
node main.js &&
s=$$? && break || s=$$?;
echo \"Tried $$i times. Waiting 5 secs...\";
sleep 5;
done; (exit $$s)"
restart: unless-stopped
networks:
- nodelocal
- nodelocal-private
ports:
- 2357:3000
volumes:
- ./data/rocketchat/app/uploads:/app/uploads
environment:
PORT: 3000
ROOT_URL: http://localhost:3000
MONGO_URL: mongodb://mongo:27017/rocketchat
MONGO_OPLOG_URL: mongodb://mongo:27017/local
MAIL_URL: smtp://smtp.email
# HTTP_PROXY: 'http://rocketchat.cdli.com'
# HTTPS_PROXY: 'http://rocketchat.cdli.com'
labels:
- "traefik.backend=rocketchat"
- "traefik.frontend.rule=Host: rocketchat.cdli.com"
depends_on:
- mongo
RocketChat容器日志:
LocalStore: store created at
LocalStore: store created at
LocalStore: store created at
{"level":40,"time":"2022-04-27T05:00:03.411Z","pid":10,"hostname":"rocketchat","name":"","name":"VoIPService","msg":"Voip is not enabled. Cant start the service"}
{"level":51,"time":"2022-04-27T05:00:03.855Z","pid":10,"hostname":"rocketchat","name":"","name":"Migrations","msg":"Not migrating, already at version 256"}
ufs: temp directory created at "/tmp/ufs"
Loaded the Apps Framework and loaded a total of 0 Apps!
+----------------------------------------------+
| SERVER RUNNING |
+----------------------------------------------+
| |
| Rocket.Chat Version: 4.5.0 |
| NodeJS Version: 14.18.3 - x64 |
| MongoDB Version: 4.0.28 |
| MongoDB Engine: mmapv1 |
| Platform: linux |
| Process Port: 3000 |
| Site URL: http://localhost:3000 |
| ReplicaSet OpLog: Enabled |
| Commit Hash: 3901054684 |
| Commit Branch: HEAD |
| |
+----------------------------------------------+
+----------------------------------------------------------------------+
| DEPRECATION |
+----------------------------------------------------------------------+
| |
| YOUR CURRENT MONGODB VERSION (4.0.28) IS DEPRECATED. |
| IT WILL NOT BE SUPPORTED ON ROCKET.CHAT VERSION 5.0.0 AND GREATER, |
| PLEASE UPGRADE MONGODB TO VERSION 4.2 OR GREATER |
| |
+----------------------------------------------------------------------+
LocalStore: store created at
LocalStore: store created at
LocalStore: store created at
{"level":40,"time":"2022-05-01T09:58:08.360Z","pid":10,"hostname":"rocketchat","name":"","name":"VoIPService","msg":"Voip is not enabled. Cant start the service"}
{"level":51,"time":"2022-05-01T09:58:08.797Z","pid":10,"hostname":"rocketchat","name":"","name":"Migrations","msg":"Not migrating, already at version 256"}
Loaded the Apps Framework and loaded a total of 0 Apps!
+----------------------------------------------+
| SERVER RUNNING |
+----------------------------------------------+
| |
| Rocket.Chat Version: 4.5.0 |
| NodeJS Version: 14.18.3 - x64 |
| MongoDB Version: 4.0.28 |
| MongoDB Engine: mmapv1 |
| Platform: linux |
| Process Port: 3000 |
| Site URL: http://localhost:3000 |
| ReplicaSet OpLog: Enabled |
| Commit Hash: 3901054684 |
| Commit Branch: HEAD |
| |
+----------------------------------------------+
+----------------------------------------------------------------------+
| DEPRECATION |
+----------------------------------------------------------------------+
| |
| YOUR CURRENT MONGODB VERSION (4.0.28) IS DEPRECATED. |
| IT WILL NOT BE SUPPORTED ON ROCKET.CHAT VERSION 5.0.0 AND GREATER, |
| PLEASE UPGRADE MONGODB TO VERSION 4.2 OR GREATER |
| |
+----------------------------------------------------------------------+
1条答案
按热度按时间e0uiprwp1#
NGINX正在接收http/https请求,代理配置应将这些请求传递到rocketchat正在侦听的主机和端口。
在docker-compose.yaml文件中,指定rocketchat服务并将主机上的端口2357Map到容器中的端口3000。
也就是说,如果NGINX作为linux服务在主机上运行(而不是作为docker-compose文件的一部分),那么您需要编辑NGINX配置的最后一行,使其位置指向localhost:2357:
看我的博客文章关于托管和管理火箭。聊天使用docker-compose...这里:
https://blog.jarrousse.org/2022/04/09/an-elegant-way-to-use-docker-compose-to-obtain-and-renew-a-lets-encrypt-ssl-certificate-with-certbot-and-configure-the-nginx-service-to-use-it/
此处为:
https://blog.jarrousse.org/2022/04/26/using-docker-compose-in-to-deploy-rocket-chat/
和此处:
https://blog.jarrousse.org/2022/08/01/migrate-a-self-hosted-manual-deployment-of-rocket-chat-to-a-deployment-based-on-docker-compose-without-losing-data/