This tutorial requires advanced knowledge. We recommend you get professionals to do this if you are not at an advanced level.
Require: phpFox 4.5.2+
The IM app requires NodeJS and Redis. In this article we will go over how to setup NodeJS and Redis on the Linux Flavor, Ubuntu. We recommend that you separate your NodeJS, Redis and HTTP server from each other. Your HTTP server is the main web server that has your phpFox source code.
...
Connect to your NodeJS server via SSH and run the command
Code Block | ||||
---|---|---|---|---|
| ||||
sudo apt-get install nodejs
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo apt-get install npm
|
...
Via SSH navigate to the folder you just uploaded. You use the CD command to do this. Example:
Code Block | ||||
---|---|---|---|---|
| ||||
cd /some/folder
|
Once you reached your NodeJS script you need to install all the libraries required to run the script.
Code Block | ||||
---|---|---|---|---|
| ||||
npm update npm install |
Next, rename the sample config file.
Code Block | ||||
---|---|---|---|---|
| ||||
mv config.js.new config.js
|
Now that NodeJS is setup you can start the process
Code Block | ||||
---|---|---|---|---|
| ||||
node index.js
|
Redis
Next, we need to install Redis.
Code Block | ||||
---|---|---|---|---|
| ||||
sudo apt-get install redis-server
|
...
Please skip this step if your phpFox site doesn't support SSL.
It requires your Chat supports SSL also if you want to use IM app on a SSL site. So, make sure that you have enabled SSL before doing below step:
Open the file config.js, set true for secure property, you also need to provide the path of private key file and cert key file, an example for the change:
Code Block | ||||
---|---|---|---|---|
| ||||
module.exports = {
port: 3000,
is_hosted: false,
secure: true, // Set this value to true if you want to use IM in SSL;
privateKey: "./private_key.key", // path to private key
cert: "./cert.crt", // path to cert key
redis: {
host: '127.0.0.1',
port: 6379
}
};
|
...
Code Block | ||||
---|---|---|---|---|
| ||||
# your SSL configuration
#ssl on;
#ssl_certificate /path/to/ssl_cert.crt;
#ssl_certificate_key /path/to/ssl_private_key.key;
location /socket.io/ {
# switch off logging
access_log off;
# redirect all HTTP traffic to 127.0.0.1:3000
proxy_pass http://127.0.0.1:3000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# WebSocket support (nginx 1.4)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
|
...