Views: 106
Last Modified: 09.07.2020

Server configuration

In this case, the key specifics are in organizing web-sockets (for) in cases when additional settings are required to avoid terminated connection via timeout by the network equipment.

Network equipment settings are not subject of this article, it presupposes that all settings are in order and web socket support is enabled.

This article's main focus is on a situation when port for ws/wss protocols must be moved for correct operation.

1. Virtual Appliance configuration

Create a config file /etc/nginx/bx/site_ext_enabled/rtc_ext.conf:

server {
	listen 1137;
	listen 1139 default_server ssl;

	#access_log off;

	server_name _;

	# ssl settings
	include bx/conf/ssl.conf;


	# Include im subscrider handlers
	include bx/conf/im_subscrider.conf;

	location / {
		deny all; 
	}
}
Take a close look at SSL (https) settings. Use the same settings and the same SSL certificate used on target site for connecting future Push server. Settings example can be taken from config file: /etc/nginx/bx/site_enabled/rtc-server.conf.

Do not forget to re-launch nginx after all adjustments are implemented.

CentOS 6:

service nginx restart

CentOS 7:

systemctl restart nginx.service

2. Opening of ports

Open ports in Bitrix Virtual Appliance:

iptables:

iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 1137 -j ACCEPT
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 1139 -j ACCEPT
iptables-save > /etc/sysconfig/iptables

firewalld:

firewall-cmd --permanent --add-port=1137/tcp
firewall-cmd --permanent --add-port=1139/tcp
firewall-cmd --reload

2. Change site settings

Add selected ports into config file bitrix/.settings.php:

'pull_s1' => 'BEGIN GENERATED PUSH SETTINGS. DON\'T DELETE COMMENT!!!!',
'pull' => Array(
    'value' =>  array(
...
        'path_to_websocket' => 'ws://#DOMAIN#:1137/bitrix/subws/',
        'path_to_websocket_secure' => 'wss://#DOMAIN#:1139/bitrix/subws/',
...
    ),
),
'pull_e1' => 'END GENERATED PUSH SETTINGS. DON\'T DELETE COMMENT!!!!',

Finally, check the performance via browser.





Courses developed by «Bitrix», Inc.