support for nginx server configuration ??
ashwintastic opened this issue · 21 comments
Hi I have installed nginx-push-stream-module
version 1.8.0 I have pasted the following code in /etc/nginx/nginx.conf
location /channels-stats {
push_stream_channels_statistics;
push_stream_channels_path $arg_id;
}
location /pub {
push_stream_publisher admin;
push_stream_channels_path $arg_id;
}
location ~ /sub/(.*) {
push_stream_subscriber long-polling;
push_stream_channels_path $1;
push_stream_message_template " {\"id\":~id~,\"channel\":\"~channel~\",\"text\":\"~text~\"}";
push_stream_longpolling_connection_ttl 30s;
}
but getting this error nginx: [emerg] unknown directive "push_stream_channels_statistics" in /etc/nginx/nginx.conf:240
where I'm doing wrong !!
Do you mind to paste the nginx -V
output and describe how you installed the module?
ThnQ for quick response nginx -V gives this
I have followed thses steps:
https://github.com/wandenberg/nginx-push-stream-module#installation-
nginx version: nginx/1.10.0 (Ubuntu)
built with OpenSSL 1.0.2g 1 Mar 2016
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat - Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with- stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads
@HiteshSomani you probably missed to use --add-module=../nginx-push-stream-module
on your configure command. There is no reference to pushstream module on nginx -V output.
If you are trying to use the dynamic version, please take a look on how to build it on Nginx documentation. If not, add the command above to your configuration and repeat the compile and install steps again.
@wandenberg I have used --add-module=../nginx-push-stream-module
but still getiing the same issue.. I need to confirm where I have to configure the http context ? now I have done at /etc/nginx/nginx.conf
Please, share the full command you are using, and your folder structure, and also your nginx.conf.
command that i'm using : sudo nginx to start server
getting this error nginx: [emerg] unknown directive "push_stream_channels_statistics" in /etc/nginx/nginx.conf
nginx.cong
server{
location /channels-stats {
push_stream_channels_statistics;
push_stream_channels_path $arg_id;
}
location /pub {
push_stream_publisher admin;
push_stream_channels_path $arg_id;
}
location ~ /sub/(.*) {
push_stream_subscriber long-polling;
push_stream_channels_path $1;
push_stream_message_template "{\"id\":~id~,\"channel\":\"~channel~\",\"text\":\"~text~\"}";
push_stream_longpolling_connection_ttl 30s;
}
}
Not the command to start the server. The command to configure, build and install the nginx.
Probably you made a mistake on it, or forgot to recompile and reinstall after add the --add-module
command I used : I used exactly these steps to install installation
for configuration I added this code configuration in /etc/nginx/nginx.conf
:
So, for sure you skip some step because on the output of you nginx -V
does not contain the word 'push' for example and it must be there if you 1) configure the module with --add-module ... 2) recompile the nginx with make
and 3) reinstalled it with sudo make install
Cool Its working but not able to do this curl -s -v --no-buffer 'http://localhost/sub/my_channel_1'
Trying 127.0.0.1...
* connect to 127.0.0.1 port 80 failed: Connection refused
* Failed to connect to localhost port 80: Connection refused
* Closing connection 0
any idea !!
I think server is not yet started but I have run this command sudo /usr/local/nginx/sbin/nginx -c $NGINX_PUSH_STREAM_MODULE_PATH/misc/nginx.conf
what shows on logs and stdout when you executed sudo /usr/local/nginx/sbin/nginx -c $NGINX_PUSH_STREAM_MODULE_PATH/misc/nginx.conf
?
(just to remember this misc/nginx.conf
must not be used for other purposes than testing.)
nothing gets printed !!!
I suggest you to uninstall everything and starts over, step by step. :)
after reinstalling getting this
nginx: [emerg] invalid event type "poll" in /home/ashwinik/pusher/nginx-push-stream- module/misc/nginx.conf:19
to fix the above I made a change
nginx: configuration file /home/ashwinik/pusher/nginx-push-stream-module/misc/nginx.conf test failed
replace poll with epoll if you are on linux and with kqueue if on MacOS
yes I did it :)
after this command sudo /usr/local/nginx/sbin/nginx -c $NGINX_PUSH_STREAM_MODULE_PATH/misc/nginx.conf
when I hit localhost for channel subcription
curl -s -v --no-buffer 'http://localhost/sub/my_channel_1'
nothing is logging
Infact curl -I http://localhost/
gives this curl: (7) Failed to connect to localhost port 80: Connection refused
which means server is not yet started ... but I run this command sudo /usr/local/nginx/sbin/nginx -c $NGINX_PUSH_STREAM_MODULE_PATH/misc/nginx.conf
the request to /sub location is only logged when it finish. It is a stream connection.
Also, if you are using the misc/nginx.conf without changing the listen line the nginx is listening on 9080
port, not 80
.
@HiteshSomani I created a Vagrantfile for you.
Just execute a vagrant up
and after that you will be able to execute curl --raw localhost:9080/sub/ch1
in one terminal and curl localhost:9080/pub?id=ch1 -d ABC
in another.
remamber to rename the file from Vagrantfile.txt to Vagrantfile
Vagrantfile.txt
@wandenberg ThnQ It's working woopi !!!