<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi All, <br>
<br>
I'm trying to use the long polling module. I got it compiled, installed
and running:- <br>
<br>
ian@titan:~$ nginx -V<br>
nginx version: nginx/0.7.65<br>
built by gcc 4.3.3 (Ubuntu 4.3.3-5ubuntu4)<br>
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<br>
ian@titan:~$<br>
<br>
But I can't get it configured properly.&nbsp; The address to write messages
to, appears not to exist whatever I do. <br>
<br>
The key part of the configuration is this:- <br>
<br>
server {<br>
&nbsp;&nbsp;&nbsp; listen&nbsp;&nbsp; 80;<br>
&nbsp;&nbsp;&nbsp; server_name coachmaster.titan.hcs;<br>
&nbsp;&nbsp;&nbsp; root /home/ian/websites/coachmaster;<br>
&nbsp;&nbsp;&nbsp; index index.php index.html index.htm;<br>
&nbsp;&nbsp;&nbsp; error_page&nbsp;&nbsp; 500 502 503 504&nbsp; /50x.html;<br>
&nbsp;&nbsp;&nbsp; location = /50x.html {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; root&nbsp;&nbsp; /var/www/nginx-default;<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; location ~ \.php$ {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fastcgi_pass 127.0.0.1:9000;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; include /etc/nginx/fastcgi_params;<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; # now to configure the long polling<br>
&nbsp;&nbsp;&nbsp; push_store_messages on;<br>
&nbsp;&nbsp;&nbsp; location /publish { <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; push_publisher;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set $push_channel_id $arg_id;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; push_message_timeout 5m;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; push_max_message_buffer_length 10;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; push_min_message_recipients 0;&nbsp; <br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; # public long-polling endpoint<br>
&nbsp;&nbsp;&nbsp; location /activity {&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; push_subscriber;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; push_subscriber_concurrency broadcast;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set $push_channel_id $arg_id;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; default_type&nbsp; text/plain;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; }<br>
}<br>
<br>
When I post to the /publish location I get a 404 error. Always.&nbsp; When I
"get" from a file that exists, I get the file content. <br>
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. <br>
<br>
This is the test script:- <br>
&lt;?php<br>
$host = $_SERVER['HTTP_HOST'];&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
$url = <a class="moz-txt-link-rfc2396E" href="http://$host/publish?id=1234">"http://$host/publish?id=1234"</a>; <br>
$ch = curl_init($url);<br>
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/json"));
<br>
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Accept: text/json")); <br>
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);&nbsp; // read data <br>
curl_setopt($ch, CURLOPT_POST, true);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // do a post <br>
curl_setopt($ch, CURLOPT_POSTFIELDS, 'A test message');<br>
$rec_data = curl_exec($ch);<br>
echo "Result\n";<br>
echo $rec_data; <br>
?&gt;<br>
<br>
This is the reply:-<br>
<pre id="line1"><span id="__firefox-tidy-id"
 style="background-color: rgb(221, 221, 255);">Result</span>
<span class="doctype">&lt;!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"&gt;</span>
&lt;<span class="start-tag">html</span>&gt;&lt;<span class="start-tag">head</span>&gt;
&lt;<span class="start-tag">title</span>&gt;404 Not Found&lt;/<span
 class="end-tag">title</span>&gt;
&lt;/<span class="end-tag">head</span>&gt;&lt;<span class="start-tag">body</span>&gt;
&lt;<span class="start-tag">h1</span>&gt;Not Found&lt;/<span
 class="end-tag">h1</span>&gt;
&lt;<span class="start-tag">p</span>&gt;The requested URL /publish was not found on this server.&lt;/<span
 class="end-tag">p</span>&gt;
&lt;/<span class="end-tag">body</span>&gt;&lt;/<span class="end-tag">html</span>&gt;
</pre>
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 <br>
check that the poster is logged in properly, neither of which I can do
in JavaScript. <br>
<br>
I would be very grateful if some kind person can spot what I'm doing
wrong - before I tear out my remaining hair!<br>
<br>
Regards<br>
<br>
Ian<br>
<br>
<br>
</body>
</html>