Keep Alive piles up

meto nginx-forum at
Mon Jun 29 21:00:00 MSD 2009

server {

                if ($host !=
                rewrite ^(.*)$$1 permanent;

        access_log  /var/www/vhosts/ combined buffer=32k;

                location = / {
                        rewrite  / index.php?action=glowna permanent;

                location / {
                        index index.html index.php;
                        root   /var/www/vhosts/;
                        include php_support;

                                if ( !-e $request_filename ) {
                                # rewrites
                                rewrite  ^/avatar/(.*)\.png /avatar/index.php?user=$1 last;
                                some rewrites
                                rewrite  ^/index\.php/(.*) /index.php?$1;
                                # end rewrites

            # PLESK statistics below
            location ^~  /plesk-stat/ {
                    autoindex on;
                    alias /var/www/vhosts/;
            # End of PLESK statistics

        include settings;

every domain is built with such config template


#php support
        if ( $request_filename ~* \.php(.*)$ ) { # is it php?
        expires off;

fastcgi_index  index.php;
fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
include fastcgi_params;


#limit conns for ddos and slowloris
limit_conn limit_per_ip 25;

error_page 404 /errors_pages/404.html;

location ^~ /errors_pages {
        alias /var/www/errors_pages;


location ^~ /phpmyadmin {
        index index.php;
        root /usr/share;
        include php_support2;


location ^~ /xcache-admin {
        index index.php;
        alias /usr/share/xcache/admin;
        #root /usr/share/xcache/admin;
        include php_support2;
        fastcgi_param  SCRIPT_FILENAME  $request_filename;
# AW-Stat Icons
location ^~ /awstats-icon/ {
        alias /usr/share/awstats/icon/;

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
location ~ /\.ht {
        deny  all;

php_support2 is same as php_support but passes queries only to local PHP.

Here you have it. As I said nothing special here.

>Using if() on $request_uri/$request_filename suggests that config
>should be rewritten, but anyway nginx shouldn't coredump.

Why? I know that if is in rewrite module in docs but can't we use it in other places?

Do you suggest to use nested location rather than if() in that case? But still (and dont yell) - it worked before.

Posted at Nginx Forum:,3374,3536#msg-3536

More information about the nginx mailing list