Question
How to add additional nginx directives globally, so that these directives will not be overwritten after updates?
Answer
Connect to a Plesk server via SSH.
Create the directives.conf file inside the
/etc/nginx/conf.d/directory:# touch /etc/nginx/conf.d/directives.conf
Now, open the created
/etc/nginx/conf.d/directives.conffile in a text editor. In this example, we use the vi editor:# vi /etc/nginx/conf.d/directives.conf
Add required directives. For example:
# cat /etc/nginx/conf.d/directives.conf
proxy_send_timeout 1200s;
proxy_read_timeout 1200s;
fastcgi_send_timeout 1200s;
fastcgi_read_timeout 1200s;
proxy_buffers 8 16k;
proxy_buffer_size 32k;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;Save the changes and close the file.
Make sure that the new directives do not break nginx configuration:
# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successfulReload nginx configuration to apply the changes:
# service nginx reload