Multiple client_max_body_size (location based)
Igor Sysoev
is at rambler-co.ru
Tue Jan 13 15:01:30 MSK 2009
On Tue, Jan 13, 2009 at 09:14:28AM -0200, Juan Fco. Giordana wrote:
> Thank you very much Igor,
>
> It seems that I forgot something while doing the combinations :)
>
> I have another question that is more or less related to this subject
> too: Is there a way to avoid entering over and over the fastcgi
> parammeters?, this would be excluding the usage of the include directive
> since the effect would be the same as typing everything.
You may set common fastcgi_param's on http or server level.
However, any fastcgi_param overrides inherited fastcgi_param's,
so you need to set all fastcgi_param's in @sitename.
You do not need
fastcgi_index index.php;
in
location ~ \.php$ {
as fastcgi_index is required for "/dir/" requests which never match "\.php$".
Also, I has moved rewrite's to exact locations.
server {
[...]
client_max_body_size 1m;
[...]
fastcgi_param SCRIPT_FILENAME /path/to/www/$fastcgi_script_name;
include fastcgi_params;
location ~ \.php$ {
try_files $uri @sitename;
fastcgi_pass 127.0.0.1:9000;
}
location = /upload-file.php {
client_max_body_size 15m;
fastcgi_pass 127.0.0.1:9000;
}
location = /upload-image.php {
client_max_body_size 2m;
fastcgi_pass 127.0.0.1:9000;
}
location @sitename {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /path/to/www/rewrite.php;
include fastcgi_params;
}
location = /aboutus.php {
rewrite ^ /about/ permanent;
}
location = /activate.php {
rewrite ^ /signup/activate/ permanent;
}
location = /something.php {
rewrite ^ /else/ permanent;
}
> server {
> [...]
> client_max_body_size 1m;
> [...]
>
> location ~ \.php$ {
> try_files $uri @sitename;
>
> fastcgi_pass 127.0.0.1:9000;
> fastcgi_index index.php;
> fastcgi_param SCRIPT_FILENAME /path/to/www/$fastcgi_script_name;
> include fastcgi_params;
> }
>
> location = /upload-file.php {
> client_max_body_size 15m;
> fastcgi_pass 127.0.0.1:9000;
> fastcgi_param SCRIPT_FILENAME /path/to/www/$fastcgi_script_name;
> include fastcgi_params;
> }
>
> location = /upload-image.php {
> client_max_body_size 2m;
> fastcgi_pass 127.0.0.1:9000;
> fastcgi_param SCRIPT_FILENAME /path/to/www/$fastcgi_script_name;
> include fastcgi_params;
> }
>
> location @sitename {
> # Avoid Link Rot.
> rewrite ^/aboutus\.php$ /about/ permanent;
> rewrite ^/activate\.php$ /signup/activate/ permanent;
> rewrite ^/something\.php$ /else/ permanent;
>
> fastcgi_pass 127.0.0.1:9000;
> fastcgi_param SCRIPT_FILENAME /path/to/www/rewrite.php;
> include fastcgi_params;
> }
> }
>
> Thanks again.
>
> Igor Sysoev wrote:
> >Yes, it's possible, however, you should correct your locations:
> >
> >- location = upload-image.php {
> >+ location = /upload-image.php {
> >
> >
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list