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

Hello Everyone.

I am using Apache Server for a web forum system(Discuz!,a php+mysql
popular in China). Yesterday I changed Apache to Nginx, v0.63.

The system runs good except one question:all functions using ajax don’t
Other functions,such as post a topic,replay,login,download, work very

The forum’s office site( runs nginx 0.63 too, so I am

BTW, I am using Nginx with Apache 2, while Apache listen to,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;
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
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
rewrite ^/space-(username|uid)-(.+).html$ /space.php?$1=$2 last;
rewrite ^/tag-(.+).html$ /tag.php?name=$1 last;
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_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
proxy_hide_header Content-Type;

The mime type file is default. And I am using URL Rewrite, it works

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.

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,
max-age=0”, FALSE);}
{eval @header(“Pragma: no-cache”);}
{eval @header(“Content-type: application/xml; charset=$charset”);}
{echo ‘<?xml version="1.0" encoding="'.$charset.'"?>’;}

I am trying to downloading the file from my site, and the official site.
file size is different. also the md5 hash.

The file is a .htm file, but in it ,it declars “Content-type:

Any ideas?


2008/5/20, baalchina [email protected]:

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 [email protected]: