How can I configure default directives for all servers in nginx? (Problems with Plesk)

I have a DV 4.0 server on media storage which is configured with nginx as a reverse proxy for apache. I want to set up some far future expiration headers (using blocks location

) and other settings for my (multiple) domains running through nginx.

Usually this is not a problem, just create a general set of rules and include

them in a block server {}

. However, Plesk automatically creates and updates blocks server {}

in separate files, which means that any changes made to these files are destroyed.

Ideally, I would like to create a generic block server {}

that will apply all servers as defaults, but if that doesn't exist, I would like to know how to add custom directives to Plesk so that they don't break off when it overwrites files.

+3


source to share


1 answer


Check the page

Yog can customize the default nginx shared hosting template:



  • mkdir / usr / local / psa / admin / conf / templates / custom / domain
  • cp / usr / local / psa / admin / conf / templates / default / domain / nginxDomainVirtualHost.php / usr / local / psa / admin / conf / templates / custom / domain /
  • add or change what you need in /usr/local/psa/admin/conf/templates/custom/domain/nginxDomainVirtualHost.php
  • / usr / local / psa / admin / bin / httpdmng --reconfigure-all # to apply the new configuration to all domains
+3


source







All Articles