We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Specify setting for nginx location

Hi. I want to specify settings only 1 url to uploading big files. Like for domain.com/api/v1/customer/upload i need to set for nginx: client_max_body_size 100m; client_body_timeout 600;

and for php: upload_max_filesize = 100M post_max_size = 100M

How can i do that?



8.1k

Because NGINX use PHP via PHP-FPM instead php5_module of Apache, you can't set any php directives in server.

You can use ini_set function in your application



2.7k

uploadmaxfilesize and postmaxsize cant be setted via ini_set

Because NGINX use PHP via PHP-FPM instead php5_module of Apache, you can't set any php directives in server.

You can use ini_set function in your application

php-fpm.conf add the following lines (and modify if needed):

php_admin_value[upload_max_filesize] = 20M
php_admin_value[max_file_uploads] = 20
php_admin_value[post_max_size] = 24M

Add the line to nginx.xonf:

client_max_body_size 20m;


2.7k

i need this settings only for 1 path - /api/v1/customer/upload, for other paths i want to use defaults

php-fpm.conf add the following lines (and modify if needed):

php_admin_value[upload_max_filesize] = 20M
php_admin_value[max_file_uploads] = 20
php_admin_value[post_max_size] = 24M

Add the line to nginx.xonf:

client_max_body_size 20m;


8.1k

uploadmaxfilesize and postmaxsize cant be setted via ini_set

Because NGINX use PHP via PHP-FPM instead php5_module of Apache, you can't set any php directives in server.

You can use ini_set function in your application

Yes. I agree. Taking off my hat :)

But settings in php-fpm conf is general set.

I use chunked upload.

In my PHP I have 20M limit, but with chunked upload I have no limit for upload file size.

The logic is simple.

You split file to chunkes of 10 or more Mb (as need) and on server just merge chunks and restore file.

Advantage - high speed of upload



2.7k
edited Feb '16

Isn't it pain in ass for netbooks? I mean file got chunked by javascript on frontend, yes? So will 100mb files cause bad expirience on low pc? And btw, how i can set limit like 100 mb on backend for that kind of uploading?

uploadmaxfilesize and postmaxsize cant be setted via ini_set

Because NGINX use PHP via PHP-FPM instead php5_module of Apache, you can't set any php directives in server.

You can use ini_set function in your application

Yes. I agree. Taking off my hat :)

But settings in php-fpm conf is general set.

I use chunked upload.

In my PHP I have 20M limit, but with chunked upload I have no limit for upload file size.

The logic is simple.

You split file to chunkes of 10 or more Mb (as need) and on server just merge chunks and restore file.

Advantage - high speed of upload



8.1k

Isn't it pain in ass for netbooks? I mean file got chunked by javascript on frontend, yes? So will 100mb files cause bad expirience on low pc? And btw, how i can set limit like 100 mb on backend for that kind of uploading?

uploadmaxfilesize and postmaxsize cant be setted via ini_set

Because NGINX use PHP via PHP-FPM instead php5_module of Apache, you can't set any php directives in server.

You can use ini_set function in your application

Yes. I agree. Taking off my hat :)

But settings in php-fpm conf is general set.

I use chunked upload.

In my PHP I have 20M limit, but with chunked upload I have no limit for upload file size.

The logic is simple.

You split file to chunkes of 10 or more Mb (as need) and on server just merge chunks and restore file.

Advantage - high speed of upload

Load capacity is not changed. Of course, you can set any limit of upload