Solutions

Vision livechat installation on linux server

Sneha Joshi Jun-22nd, 2021 12:33 0 0


Vision livechat installation [CentOS,Linux,etc]

  1. Install nodejs [version 12.x]
  2. Install npm [vesion 6.x]
  3. Install pm2 [version 3.5.x]
  4. Copy server.js, router.js and package.json on root
  5. Go to the path where package.json is copied
  6. Execute the command npm install
  7. Set the reverse proxy as below

ProxyPass http://127.0.0.1:3000

ProxyPassReverse http://127.0.0.1:3000

  1. Set the SSL
  2. Start the server using command pm2 start server.js

[root@nodejs html]# node -v

v12.16.1

[root@nodejs html]# npm -v

6.13.4

HAProxy :

global

log 127.0.0.1 local2

chroot /var/lib/haproxy

pidfile /var/run/haproxy.pid

maxconn 4000

user haproxy

group haproxy

daemon

# Default SSL material locations

ca-base /etc/haproxy/ssl_dir

crt-base /etc/haproxy/ssl_dir

tune.ssl.default-dh-param 2048

# turn on stats unix socket

stats socket /var/lib/haproxy/stats

defaults

mode http

log global

option httplog

option dontlognull

option httpchk

option http-server-close

option forwardfor except 127.0.0.0/8

option redispatch

retries 3

timeout http-request 1200s

timeout queue 20m

timeout connect 1200s

timeout client 20m

timeout server 20m

timeout http-keep-alive 1200s

timeout check 1200s

maxconn 3000

frontend LB

bind 184.95.46.174:80

bind 184.95.46.174:443 ssl crt /etc/ssl/private/sachlivechat.visionhelpdesk.com.pem

reqadd X-Forwarded-Proto: http

redirect scheme https if !{ ssl_fc }

default_backend LB

option forwardfor /*Enable insertion of the X-Forwarded-For header to requests sent to servers*/

acl is_websocket path_beg /chat/ /* redirects chat request to websocket backend*/

acl is_websocket hdr(Upgrade) -i WebSocket

acl is_websocket hdr_beg(Host) -i ws

use_backend websockets if is_websocket

backend LB 184.95.46.174:80

mode http

stats enable /* Enables HAProxy statistics */

stats hide-version

stats uri /stats

stats realm Haproxy Statistics

stats auth haproxy:redhat # Credentials for HAProxy Statistic report page.

balance roundrobin # Load balancing will work in round-robin process.

option httpclose /*connection is closed by the server after the response, the client does not need to know the content length.*/

option forwardfor /*Enable insertion of the X-Forwarded-For header to requests sent to servers*/

http-request add-header X-Forwarded-Proto https if { ssl_fc }

http-request add-header X-Forwarded-For %[src]

http-response replace-header Set-Cookie (JSSSSIONID=[^;]); Secure(.) 12

http-response replace-value Set-Cookie (.*) 1; HttpOnly;

http-response replace-value Set-Cookie (.*) 1; Secure

cookie LB insert

server AP01 198.15.80.107:80 cookie AP01 check

server AP02 66.85.166.162:80 cookie AP02 check

backend websockets

balance source

option http-server-close /*enables HTTP connection-close mode on the server side while keeping the ability to support HTTP keep-alive and pipelining on the client side. This provides the lowest latency on the client side (slow network) and the fastest session reuse on the server side to save server resources*/

option forceclose /*enables the parsing of the full request and response, which means we can close the connection to the server very quickly, releasing some resources earlier than with httpclose.*/

http-request add-header X-Forwarded-Proto https if { ssl_fc }

http-request add-header X-Forwarded-For %[src]

http-response replace-header Set-Cookie (JSSSSIONID=[^;]); Secure(.) 12

http-response replace-value Set-Cookie (.*) 1; HttpOnly;

http-response replace-value Set-Cookie (.*) 1; Secure

server ws-server1 198.15.80.107:80 check

====================================================================================================================

Reverse proxy on node server

====================================================================================================================

ServerName sachlivechat.visionhelpdesk.com

# ServerAlias techsuppport.seqrite.com

DocumentRoot /home1/sachin.visionhelpdesk/public_html

AllowOverride All

# Allow open access:

Require all granted

Options -Indexes +FollowSymLinks

AllowOverride None

Require all granted

ProxyPass http://127.0.0.1:3000

ProxyPassReverse http://127.0.0.1:3000

#RewriteEngine on

#RewriteCond %{SERVER_NAME} =sachlivechat.visionhelpdesk.com

#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

Vote

Was this article helpful?
0 out of 0 found this helpful