Symptoms
-
Additional nginx directives are not applied (for example, leverage browser cache settings):
location ~* .(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
expires max; log_not_found off;
} -
nginx proxy mode at Domains > example.com > Apache & nginx settings is disabled (all content is served by nginx).
-
"Serve static files directly by nginx" option is enabled Domains > example.com > Apache & nginx settings
Cause
The option "Serve static files directly by nginx" interferes with additional nginx directives.
Resolution
Disable "Serve static files directly by nginx" for a single domain
- Login to Plesk
- Navigate to Domains > example.com > Apache & nginx settings
- Disable the option Serve static files directly by nginx and press OK.
Disable "Serve static files directly by nginx" for all domains
-
Connect to the server via SSH
-
Execute the following command to disable the option for all domains where it is enabled:
# for i in $(plesk bin domain -l); do j=$(plesk bin domain --show-web-server-settings $i | grep -A 1 nginx-serve-static | awk 'FNR==2 {print}'); printf "$i: $jn"; [ "$j" == "true" ] && plesk bin domain --update-web-server-settings $i -nginx-serve-static false; done