Config help needed to create long-polling location

Hi All,

I’m trying to use the long polling module. I got it compiled, installed
and running:-

ian@titan:~$ nginx -V
nginx version: nginx/0.7.65
built by gcc 4.3.3 (Ubuntu 4.3.3-5ubuntu4)
configure arguments: --with-openssl=/usr/lib/ssl/ --sbin-path=/usr/sbin
–conf-path=/etc/nginx/nginx.conf
–add-module=/home/ian/sources/nginx_http_push_module-0.69
ian@titan:~$

But I can’t get it configured properly. The address to write messages
to, appears not to exist whatever I do.

The key part of the configuration is this:-

server {
listen 80;
server_name coachmaster.titan.hcs;
root /home/ian/websites/coachmaster;
index index.php index.html index.htm;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/nginx-default;
}
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
include /etc/nginx/fastcgi_params;
}
# now to configure the long polling
push_store_messages on;
location /publish {
push_publisher;
set $push_channel_id $arg_id;
push_message_timeout 5m;
push_max_message_buffer_length 10;
push_min_message_recipients 0;
}
# public long-polling endpoint
location /activity {
push_subscriber;
push_subscriber_concurrency broadcast;
set $push_channel_id $arg_id;
default_type text/plain;
}
}

When I post to the /publish location I get a 404 error. Always. When I
“get” from a file that exists, I get the file content.
When I post to a .php that exists, it gets run and its output is
returned, so I’m fairly confident that the trouble is in the config file
or my understanding, not the php.

This is the test script:-

<?php $host = $_SERVER['HTTP_HOST']; $url = "http://$host/publish?id=1234"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/json")); curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Accept: text/json")); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // read data curl_setopt($ch, CURLOPT_POST, true); // do a post curl_setopt($ch, CURLOPT_POSTFIELDS, 'A test message'); $rec_data = curl_exec($ch); echo "Result\n"; echo $rec_data; ?>

This is the reply:-

Result

404 Not Found

Not Found

The requested URL /publish was not found on this server.

If you are wondering why I should do the post from php, it is because I
want to log the info posted as well, and
check that the poster is logged in properly, neither of which I can do
in JavaScript.

I would be very grateful if some kind person can spot what I’m doing
wrong - before I tear out my remaining hair!

Regards

Ian

On 07/05/2010 17:54, Ian H. wrote:
Big snip.

OK. This is embarrassing.

There is nothing the matter with the config I posted.

I was not testing on the machine I had set up!

Note to self - don’t stay up half election night - and then expect to
think straight the next morning!

Regards

Ian