** Linux VM的安装指南**

部署到Linux VM

本指南将帮助您在Ubuntu 18.04 LTS / 20.04 LTS / 20.10上安装ChatWoot。我们已经准备了一个部署脚本供您运行。请参阅脚本,并可以随意进行相应的更改,如果您在非ubuntu系统上。 对于Ubuntu 18.04,使用以下脚本

    https://raw.githubusercontent.com/chatwoot/chatwoot/develop/deployment/setup_18.04.sh 

对于Ubuntu 20.04或Ubuntu 20.10,请使用以下脚本。

    https://raw.githubusercontent.com/chatwoot/chatwoot/develop/deployment/setup_20.04.sh

安装步骤

创建一个setup.sh文件并从上面的链接复制内容或使用以下命令

     wget  -O setup.sh
    chmod 755 setup.sh
    ./setup.sh master 

执行脚本,它将负责初始的ChatWoot设置。 ChatWoot安装现在可以在http:// {您的\ _ip \ _address}上访问:3000

配置nginx,让我们加密

配置nginx作为前端代理。

    cd /etc/nginx/sites-enabled
    nano yourdomain.com.conf  

在服务器\ _name中替换YourDomain.com之后,请使用以下NGINX配置。

    server {
      server_name ;
    
      # Point upstream to Chatwoot App Server
      set $upstream 127.0.0.1:3000;
    
      # Nginx strips out underscore in headers by default
      # Chatwoot relies on underscore in headers for API
      # Make sure that the config is turned on.
      underscores_in_headers on;
      location /.well-known {
        alias /var/www/ssl-proof/chatwoot/.well-known;
      }
    
      location / {
        proxy_pass_header Authorization;
        proxy_pass http://$upstream;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Ssl on; # Optional
    
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    
        proxy_http_version 1.1;
        proxy_set_header Connection “”;
        proxy_buffering off;
    
        client_max_body_size 0;
        proxy_read_timeout 36000s;
        proxy_redirect off;
      }
      listen 80;
    }  

通过运行以下命令来验证并重新加载nginx配置。

     nginx -t
    systemctl reload nginx 

运行让我们加密并配置SSL证书。

     mkdir -p /var/www/ssl-proof/chatwoot/.well-known
    certbot --webroot -w /var/www/ssl-proof/chatwoot/ -d yourdomain.com -i nginx 

现在应该可以从https://yourdomain.com访问您的chatwoot安装。

配置所需的环境变量

对于chatwoot安装,要正确地运行,您需要配置一些基本环境变量,例如frontend \ _url,mailer和云存储配置。请参阅环境变量以获取完整列表。 登录为chatwoot并编辑.env文件。

    # Login as chatwoot user
    
    sudo -i -u chatwoot
    cd chatwoot
    nano .env  

更新所需的环境变量并重新启动ChatWoot服务器,并享受使用您的自托管ChatWoot

     systemctl restart chatwoot.target
 简体中文