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

baalchina baalchina at
Tue May 20 05:42:41 MSD 2008

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( runs nginx 0.63 too, so I am confused...

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 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;
                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_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.

More information about the nginx mailing list