Nginx with a php forum, ajax function doesn't work

baalchina baalchina at gmail.com
Tue May 20 07:22:36 MSD 2008


Finally...
The question is, in nginx config, when forwarding php to apache,

#proxy_hide_header Content-Type;

maybe here changed the content-type of the ajax file,so it doesn't work.

I delete this line,It work good now.

Thanks everyone.


2008/5/20, baalchina <baalchina at gmail.com>:
>
> er...I think I found the problem.
>
> In this forum system, ajax using a template calling "header_ajax.htm".
>
> The content of the file is:
>
> ---------------------------------------------------------------------------------
> {eval ob_end_clean();}
> {eval ob_start();}
> {eval @header("Expires: -1");}
> {eval @header("Cache-Control: no-store, private, post-check=0, pre-check=0,
> max-age=0", FALSE);}
> {eval @header("Pragma: no-cache");}
> {eval @header("Content-type: application/xml; charset=$charset");}
> {echo '<?xml version="1.0" encoding="'.$charset.'"?>';}
> <root><![CDATA[
>
> ---------------------------------------------------------------------------------
>
> I am trying to downloading the file from my site, and the official site.
> The file size is different. also the md5 hash.
>
> The file is a .htm file, but in it ,it declars "Content-type:
> application/xml".
>
> Any ideas?
>
> Thankyou~
>
>
> 2008/5/20, baalchina <baalchina at gmail.com>:
>>
>> Hello Everyone.
>>
>> I am using Apache Server for a web forum system(Discuz!,a php+mysql forum
>> popular in China). Yesterday I changed Apache to Nginx, v0.63.
>>
>> The system runs good except one question:all functions using ajax don't
>> work.
>> Other functions,such as post a topic,replay,login,download, work very
>> well.
>>
>> The forum's office site(www.discuz.net) runs nginx 0.63 too, so I am
>> confused...
>>
>> BTW, I am using Nginx with Apache 2, while Apache listen to
>> 127.0.0.1:81,processing the php requests. Here is my nginx config file,
>>
>>
>> ======================================================================
>> user  www www;
>> worker_processes  4;
>> error_log  /data/logs/nginx/error.log;
>> events {
>>    worker_connections  10240;
>> }
>>
>>
>> http {
>>    include       mime.types;
>>    default_type  application/octet-stream;
>>    limit_zone   one  $binary_remote_addr  10m;
>>    sendfile        on;
>>    tcp_nopush     on;
>> tcp_nodelay    off;
>>    keepalive_timeout  10;
>>      gzip on;
>>    server {
>>        listen       80;
>>        server_name  bbs.nau.edu.cn;
>>       location /status {
>>        stub_status             on;
>>        access_log              off;
>>        auth_basic              "NginxStatus";
>>        auth_basic_user_file  htpasswd;
>>        }
>>
>>        location / {
>>            root   /data/web/bbs;
>>            index  index.php index.html index.htm;
>> #Discuz! Rewrite Rules
>> rewrite ^/archiver/((fid|tid)-[\w\-]+\.html)$ /archiver/index.php?$1 last;
>> rewrite ^/forum-([0-9]+)-([0-9]+)\.html$ /forumdisplay.php?fid=$1&page=$2
>> last;
>> rewrite ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /viewthread.php?
>> tid=$1&extra=page\%3D$3&page=$2 last;
>> rewrite ^(.*)/profile-(username|uid)-(.+)\.html$ $1/viewpro.php?$2=$3
>> last;
>> rewrite ^/space-(username|uid)-(.+)\.html$ /space.php?$1=$2 last;
>> rewrite ^/tag-(.+)\.html$ /tag.php?name=$1 last;
>>                break;
>>                error_page 404 /404.html;
>>                error_page 403 /403.html;
>>        }
>>     error_page   500 502 503 504  /50x.html;
>>        location = /50x.html {
>>            root   html;
>>        }
>>     location ~ \.php$ {
>>                proxy_pass   http://127.0.0.1:81;
>>                proxy_redirect          off;
>>                proxy_set_header Host $host;
>>                proxy_set_header X-Real-IP $remote_addr;
>>                proxy_set_header X-Forwarded-For
>> $proxy_add_x_forwarded_for;
>>                proxy_hide_header Content-Type;
>>        }
>> }
>> }
>> =======================================================================
>>
>> The mime type file is default. And I am using URL Rewrite, it works well.
>>
>> I think it may be the mime type problem, but cannot find the solution.
>>
>> So, does anyone meet the same question with me?
>>
>> Thanks a lot.
>>
>>
>>
>
>
> --
> from:baalchina




-- 
from:baalchina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20080520/e5d2589c/attachment.html>


More information about the nginx mailing list