Server requirements

  1. SSH root account (VPS or Dedicated Server)
  2. Admin account of phpFox site

Server configuration verification

Case 1: HTTP

Moving to project at PF.Base/ynchat through "cd" command (Use Terminal)

sh runcheck.sh start (start socket 9009)

sh runcheck.sh status ( verify whether it runs or not)

Case 2: HTTPS

You need to set up Stunnel

Require: - we make tutorial base on CentOS repository, if your server is other environment, please check https://www.stunnel.org/index.html for more information. For more infomaton about configuration of Stunnel, please following https://www.stunnel.org/static/stunnel.html

Steps:
Required: Log in into SSH root and perform the below steps
01. Install Stunnel by yum with command: "yum install stunnel"
02. After install successfully, create configuration file and put in /etc/stunnel/stunnel.conf (You can put other place for your preferences)
03. Details of configuration file is below:

sslVersion = all
options = NO_SSLv2
cert = path/to/cert_file
CApath = path/to/folder_ssl
CAfile = path/to/cacert_file
key = path/to/key_file
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
debug = 7
output = /var/log/stunnel.log
[websocket]
accept = which getting from AdminCP > Apps > Social Chat > Settings > Stunnel Port>
connect = which getting from AdminCP > Apps > Social Chat > Settings > Web Socket Port>
TIMEOUTclose = 0

04. Execute command "stunnel /etc/stunnel/stunnel.conf" Congratulations! You finished the setup process.

Specific case as site is HTTPS (SSL) but through CloudFlare or hidden domain IP

You can verify whether it's through CloudFlare or not with tool https://network-tools.com/

DNS servers: "isla.ns.cloudflare.com" and "todd.ns.cloudflare.com"

(CloudFlare)

I supposed that your domain is through Cloudflare so let us proceed below

Create a sub domain as "chat.yourdomain" and point to your main server IP
Ex: chat.phpfox4templatesdemo.younetco.com (Place it in Social Chat configuration - phpFox site)

Check Port

Change "xxx" below to the port needed to verify (Ex: 9009 as Socket and 9020 as Stunnel - they're default settings in back-end of Social Chat)

netstat -plunt | grep xxx

Open/Save Firewall

Its purpose is for clients to connect to server on those ports to chat each other

# open ports
iptables -I INPUT -p tcp --dport 9009 --syn -j ACCEPT
iptables -I INPUT -p tcp --dport 9020 --syn -j ACCEPT

# save firewall
service iptables save
or
iptables-save

Settings of Social Chat app

AdminCP >> Apps >> Installed >> Social Chat >> Settings >> Your Server IP public

IP address if No SSL
Domain name if SSL

Nginx server configuration (if you use Nginx server)

 location ~* ^/PF.Base/module/ynchat/api.php/(.*) {
  try_files $uri /PF.Base/module/ynchat/api.php;
}
February 22, 2019
Category: Social Chat