美文网首页
rocket.chat 备置好服务器端以后手机端无法链接

rocket.chat 备置好服务器端以后手机端无法链接

作者: linekite | 来源:发表于2019-03-04 09:48 被阅读0次
image

rocket.chat 备置好服务器端以后手机端无法链接,一直尝试链接服务器,出现这种情况是因为服务器端的wss 服务无法链接。正常情况下,服务器是已经准备好了,ws 链接,但手机端需要wss 链接。这种情况下,需要我们配置好服务器。根据你服务器的配置不同,对应的方法不同。

1.nginx
准备好你的域名的ssl 证书,同时备置改成:

# Upstreams
upstream backend {
    server 127.0.0.1:3000;
}

# HTTPS Server
server {
    listen 443;
    server_name your_hostname.com;

    # You can increase the limit if your need to.
    client_max_body_size 200M;

    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;
    }
}

2.Apache 配置

<VirtualHost *:443>

ServerAdmin it@domain.com

ServerName chat.domain.com

ErrorLog /var/log/chat.domain.com_error.log

TransferLog /var/log/chat.domain.com_access.log

LogLevel info

SSLEngine On

SSLCertificateFile /etc/ssl/certs/chat.domain.com.crt

SSLCertificateKeyFile /etc/ssl/private/chat.domain.com.key

SSLCertificateChainFile /etc/ssl/certs/intermediate.ca.pem

<Location />

        Order allow,deny

        Allow from all

</Location>

RewriteEngine On

RewriteCond %{HTTP:Upgrade} =websocket [NC]

RewriteRule /(.*)          ws://localhost:3000/$1 [P,L]

RewriteCond %{HTTP:Upgrade} !=websocket [NC]

RewriteRule /(.*)          http://localhost:3000/$1 [P,L]

ProxyPassReverse / http://localhost:3000/

</VirtualHost>

修改配置以后注意重启对应的服务

相关文章

网友评论

      本文标题:rocket.chat 备置好服务器端以后手机端无法链接

      本文链接:https://www.haomeiwen.com/subject/pflbuqtx.html