Order of statements in server section

David mishy.cth at gmail.com
Thu Sep 25 12:55:06 MSD 2008


Hello,

Is there a specific order in which statements should be put in the server
section of nginx.conf ?

I ask because I'm nearing having to replace nginx and php-fpm with Apache and
PHP as a module :-/ Nothing I do seems to stop the 504 errors and large latency
on ALL form POST. I've asked both on here, and on the php-fpm mailing lists and
no one seems to have the solution.

This is my current setup:

server {
        listen          xxx.xxx.xxx.xxx;
        server_name     www.mydomain.com;
        access_log      /var/log/nginx/mydomain.com.access.log main;
        index   index.php index.html;
        root    /home/user/public_html;
        include /usr/local/nginx/defaults.conf;
        include /usr/local/nginx/expires.conf;
        error_page  401              /error_documents/401.php;
        error_page  403              /error_documents/403.php;
        error_page  404              /error_documents/404.php;
        error_page  500              /error_documents/500.php;

        location ^~ /forums/admincp {
                auth_basic            "Authorization Required";
                auth_basic_user_file  /home/user/priv/.htpasswd;
                location ~ \.php$ {
                        fastcgi_pass 127.0.0.1:9000;
                }
       }

       location ^~ /forums/modcp {
                auth_basic            "Authorization Required";
                auth_basic_user_file  /home/user/priv/.htpasswd;
                location ~ \.php$ {
                        fastcgi_pass 127.0.0.1:9000;
                }
        }

       location ^~ /cms {
                auth_basic            "Authorization Required";
                auth_basic_user_file  /home/user/priv/.htpasswd;
                location ~ \.php$ {
                        fastcgi_pass 127.0.0.1:9000;
                }
        }

        location ~ \.php$ {
                fastcgi_pass 127.0.0.1:9000;
        }

        all my rewrites
}

server {
        listen          192.168.30.10;
        server_name mydomain.com www.mydomain.co.uk mydomain.co.uk;
        rewrite ^(.*)$ http://www.mydomain.com$1 permanent;
}







More information about the nginx mailing list