belukov / bx-nginx-push

4 stars 1 forks source link

Step Three #2

Open samkh81 opened 8 years ago

samkh81 commented 8 years ago

Hi, Thanks for uploading this. I didn't understand step three. I am new to linux.

Can you please explain this more:

make symlink to push.conf from conf.d (must be inclided in nginx.conf) cd conf.d ln -s ../bx/push.conf

Where do I find conf.d file? I tried searching for it on my server (hosted online) and got these results: ./etc/fonts/conf.d ./usr/local/cpanel/base/horde/turba/config/conf.d ./usr/share/ghostscript/conf.d ./usr/share/doc/dovecot-2.2.21/example-config/conf.d ./usr/share/abrt/conf.d

belukov commented 8 years ago

Hello. conf.d is a directory and usually exists in /etc/nginx/ dir. All configs from conf.d automatically included in nginx.conf something like this:

# /etc/nginx/nginx.conf
include /etc/nginx/conf.d/*.conf;

you can make it easier. just add into your nginx.cong this line:

include /etc/nginx/bx/push.conf
belukov commented 8 years ago

I just corrected README, maybe now it will be more helpfull. Let me know about result

samkh81 commented 8 years ago

I did that but my Bitrix server check still says:

Error! Cannot connect to nginx-push-stream module for sending instant messages

Do I need to reload the config file or do something else? Any ideas what the issue could be?

Appreciate your help Thanks

belukov commented 8 years ago

Try to check:

  1. Opened ports. By default, 8893 - for http clients, 8894 - for https clients, and 8895 - for server (connect locally) therefore 8893 must be opened for outdor connections
  2. Look at Push&Pull module settings page in admin panel, there some nessesary settings too
  3. To localize the problem, use next trick from console:
# open new channel
curl -s -v -X POST 'http://127.0.0.1:8895/bitrix/pub/?CHANNEL_ID=test' -d 'Hello World!'

you must see something like {"channel": "test", "published_messages": "1", "stored_messages": "1", "subscribers": "0"} In other console connect local client:

curl -s -v --no-buffer 'http://localhost:8893/bitrix/sub/?CHANNEL_ID=test'

If ok, you will see some HTTP headers and console will waiting response. Then in first console repeat POST command, in second you will see some message If that ok, try to connect client from some other server by IP or domain name That help you to understand where is problem

Glad to help :)

samkh81 commented 8 years ago

When I ran this:

open new channel

curl -s -v -X POST 'http://127.0.0.1:8895/bitrix/pub/?CHANNEL_ID=test' -d 'Hello World!'

I got this response: About to connect() to 127.0.0.1 port 8895 (#0)

so I seem to have missed something but I don't know where the problem is

belukov commented 8 years ago

It means that nobody listening port 8895, or maybe firewall too strict.

to ensure that nginx is listening, run this:

netstat -antp

there must be strings like:

tcp        0      0 0.0.0.0:8893                0.0.0.0:*                   LISTEN      -
tcp        0      0 0.0.0.0:8894                0.0.0.0:*                   LISTEN      -
tcp        0      0 127.0.0.1:8895              0.0.0.0:*                   LISTEN      -

to check firewall rules:

sudo iptables -L -n

to ansure that push&pull module included, run

nginx -V

and find nginx-push-stream-module . if exists then ok. else try to reinstall nginx with module. don't forget remove old instance before? it may cause problems in some cases..

samkh81 commented 8 years ago

Netsat results:

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:2077 0.0.0.0:* LISTEN 4791/cpdavd - accep tcp 0 0 0.0.0.0:2078 0.0.0.0:* LISTEN 4791/cpdavd - accep tcp 0 0 0.0.0.0:2079 0.0.0.0:* LISTEN 4791/cpdavd - accep tcp 0 0 0.0.0.0:2080 0.0.0.0:* LISTEN 4791/cpdavd - accep tcp 0 0 0.0.0.0:993 0.0.0.0:* LISTEN 4664/dovecot tcp 0 0 0.0.0.0:2082 0.0.0.0:* LISTEN 1933/cpsrvd (SSL) - tcp 0 0 0.0.0.0:995 0.0.0.0:* LISTEN 4664/dovecot tcp 0 0 0.0.0.0:2083 0.0.0.0:* LISTEN 1933/cpsrvd (SSL) - tcp 0 0 0.0.0.0:2086 0.0.0.0:* LISTEN 1933/cpsrvd (SSL) - tcp 0 0 0.0.0.0:2087 0.0.0.0:* LISTEN 1933/cpsrvd (SSL) - tcp 0 0 0.0.0.0:587 0.0.0.0:* LISTEN 23556/exim tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 4664/dovecot tcp 0 0 127.0.0.1:783 0.0.0.0:* LISTEN 1042/spamd child tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN 4664/dovecot tcp 0 0 0.0.0.0:2095 0.0.0.0:* LISTEN 1933/cpsrvd (SSL) - tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 5402/httpd tcp 0 0 0.0.0.0:2096 0.0.0.0:* LISTEN 1933/cpsrvd (SSL) - tcp 0 0 0.0.0.0:465 0.0.0.0:* LISTEN 23556/exim tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 3689/pure-ftpd (SER tcp 0 0 192.163.239.29:53 0.0.0.0:* LISTEN 1257/named tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 1257/named tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1447/sshd tcp 0 0 0.0.0.0:9080 0.0.0.0:* LISTEN 10876/nginx tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 23556/exim tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 1257/named tcp 0 0 0.0.0.0:26 0.0.0.0:* LISTEN 23556/exim tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 5402/httpd tcp 0 3376 192.163.239.29:22 77.30.214.210:53993 ESTABLISHED 16103/sshd tcp 0 0 192.163.239.29:80 77.30.214.210:54366 TIME_WAIT - tcp 0 0 :::993 :::* LISTEN 4664/dovecot tcp 0 0 :::995 :::* LISTEN 4664/dovecot tcp 0 0 :::3306 :::* LISTEN 23195/mysqld tcp 0 0 :::110 :::* LISTEN 4664/dovecot tcp 0 0 :::143 :::* LISTEN 4664/dovecot tcp 0 0 :::80 :::* LISTEN 5402/httpd tcp 0 0 :::21 :::* LISTEN 3689/pure-ftpd (SER tcp 0 0 :::22 :::* LISTEN 1447/sshd tcp 0 0 :::443 :::* LISTEN 5402/httpd

samkh81 commented 8 years ago

I don't see entries for ports 8893-8894-8895

belukov commented 8 years ago

Me too..

Hmm.. nignx listening 9080, httpd listening 80 ? Why? oO

What OS are you using? CentOs or somthing nearest? If so, you better try that: https://dev.1c-bitrix.ru/learning/course/?COURSE_ID=37&LESSON_ID=6489 (i don't know where find ENG copy of this page)

Anyway, check that nginx include module

to ensure that push&pull module included, run

nginx -V

and find nginx-push-stream-module . if exists then ok. else try to reinstall nginx with module. don't forget remove old instance before? it may cause >problems in some cases..

samkh81 commented 8 years ago

When I ran command nginx -V I got this response -bash: nginx: command not found

Does this mean nginx is not installed? My server is online hosted VPS server with CentOS running on it. I thought by installing nginx-push-stream-module that meant I had installed nginx. Or is it a different installation? after I installed nginx-push-stream-module then I installed your package

samkh81 commented 8 years ago

I guess nginx was not installed. I found a link on bluehost on how to install it. I did that and now when I run nginx -V command I get this: nginx version: nginx/1.9.14 built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) built with OpenSSL 1.0.1e-fips 11 Feb 2013 TLS SNI support enabled configure arguments: --with-http_flv_module --with-ipv6 --with-http_mp4_module --with-pcre=/usr/local/src/publicnginx/pcre-8.35 --sbin-path=/usr/local/sbin --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-http_realip_module --with-http_ssl_module --http-client-body-temp-path=/tmp/nginx_client --http-proxy-temp-path=/tmp/nginx_proxy --http-fastcgi-temp-path=/tmp/nginx_fastcgi --with-http_stub_status_module

samkh81 commented 8 years ago

but bitrix still shows an error of Error! Cannot connect to nginx-push-stream module for sending instant messages

any ideas what to do now? Sorry to bother you

belukov commented 8 years ago

For CentOs exists complex solution: https://dev.1c-bitrix.ru/learning/course/?COURSE_ID=37&LESSON_ID=6489 just do that (as root):

wget http://repos.1c-bitrix.ru/yum/bitrix-env.sh   
chmod +x bitrix-env.sh  
./bitrix-env.sh
samkh81 commented 8 years ago

I think its almost working but now I get this error:

[emerg] unknown directive "push_stream_shared_memory_size" in /etc/nginx/bx/conf/im_settings.conf:3

any ideas?

samkh81 commented 8 years ago

I finally got nginx-push-stream module installed. I was previously installing under the incorrect nginx folder . Now bitrix is no longer showing this error: Error! Cannot connect to nginx-push-stream module for sending instant messages

now Notifications to mobile devices (push notifications) shows that push and pull is configured correctly

however, Real time business chat shows error: Error! nginx-push-stream module functions incorrectly.

Live comments shows error: Error! nginx-push-stream module is required to show comments in real time but not configured properly.

and video calls shows error Error! nginx-push-stream module is required to make video calls but not configured properly.