A
A
anton1x2013-12-24 14:41:37
PHP
anton1x, 2013-12-24 14:41:37

How to set post_max_size for a separate site folder in nginx?

Hello,
there was a problem with the nginx config, it's impossible to set via fastcgi_param PHP_VALUE "post_max_size=512M" for the /administrator location - phpinfo shows that the value is changing and for /
config for the site this content:

server {
    listen      80;
    server_name  localhost;
    index index.html index.php;
   

    location / {
        root   /var/www/site/data/;
        index  index.php index.html index.htm;
        rewrite ^/([A-z0-9_]*)$ /index.php?id=$1/ last;
        rewrite ^/([A-z0-9_]*)/$ /index.php?id=$1/ last;
        rewrite ^/([A-z0-9_]*)/([A-z0-9_|%/\-]*)$ /index.php?id=$1/$2 last;
      location /administrator{
    index index.php;
    location ~ ^/administrator/(.+\.php)$ {
        fastcgi_param PHP_VALUE "
      post_max_size=512M
      upload_max_filesize=512M
        ";
        fastcgi_pass   unix:/var/run/php5-fpm.sock;
    		    fastcgi_index  index.php;
    		    include        fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME  /var/www/site/data/$fastcgi_script_name;
    }
      }
    }

#    location /administrator {
#	index index.php;
#	root /var/www/site/data/;
#	fastcgi_param PHP_FLAG "display_startup_errors=on";
#	fastcgi_param PHP_FLAG "display_errors=on";
#    }



    location ~ \.php$ {
        fastcgi_pass   unix:/var/run/php5-fpm.sock;
        fastcgi_index  index.php;
        include        fastcgi_params;
  fastcgi_param  SCRIPT_FILENAME  /var/www/site/data/$fastcgi_script_name;
  

    }


}

I would be very grateful if you could help me to solve this problem.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aleksandr Kuznetsov, 2013-12-25
@x_T

PHP_VALUE is stored in the fastcgi worker until a new value arrives
Either set a lower value for post_max_size and upload_max_filesize for the rest of the site, or get a second pool with increased limits and use it only for /administrator URLs

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question