-
Notifications
You must be signed in to change notification settings - Fork 6
/
Increase Nginx and PHP Request Timeout, RAM & Upload Size.txt
68 lines (55 loc) · 1.88 KB
/
Increase Nginx and PHP Request Timeout, RAM & Upload Size.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
Before you continue, please check your PHP version
* My PHP version is 8.2 so i will be using that.
* I will increase Upload size to 120MB
* I will increase timeout limit to 300 Seconds (5 Minutes)
* Website specific conf files are in /etc/nginx/sites-available
* I will increase RAM limit to 512MB
* I will increase Max files upload in 1 request to 25
=================================================
Check PHP version
=================================================
$ php -v
=================================================
NGINX Configuration
=================================================
1. Increase Default File upload size/timeout (for all websites)
$ sudo nano /etc/nginx/nginx.conf
(Copy and Paste the following anywhere in 'http' block)
client_max_body_size 120M;
client_body_timeout 300s;
client_header_timeout 300s;
send_timeout 300s;
proxy_read_timeout 300s;
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
fastcgi_connect_timeout 300s;
fastcgi_send_timeout 300s;
fastcgi_read_timeout 300s;
2. Increase Request timeout (504 Gateway error fix)
$ sudo nano /etc/php/8.2/fpm/pool.d/www.conf
(Find the following key, uncomment it then change the value)
request_terminate_timeout = 300
=================================================
PHP Configuration
=================================================
1. PHP CLI version
$ sudo nano /etc/php/8.2/cli/php.ini
upload_max_filesize = 120M
max_file_uploads = 25
post_max_size = 120M
max_execution_time = 300
max_input_time = 300
memory_limit = 512M
2. PHP FPM version
$ sudo nano /etc/php/8.2/fpm/php.ini
upload_max_filesize = 120M
max_file_uploads = 25
post_max_size = 120M
max_execution_time = 300
max_input_time = 300
memory_limit = 512M
=================================================
Restart Services
=================================================
$ sudo systemctl restart nginx.service
$ sudo systemctl restart php8.2-fpm.service