Skip to content

Instantly share code, notes, and snippets.

@mbrughi
Forked from rutger1140/gist:8548548
Last active September 30, 2022 14:13
Show Gist options
  • Save mbrughi/b88fd3dbc9d7953cb148f1a471b4a946 to your computer and use it in GitHub Desktop.
Save mbrughi/b88fd3dbc9d7953cb148f1a471b4a946 to your computer and use it in GitHub Desktop.
Plesk Obsidian 18.0.46 nginx (tested) configuration settings for WordPress (not valid for all websites... please test first) | Put inside domain "Hosting & DNS" ---> "Apache & nginx settings"
# Source: https://www.websavers.org/how-to-speed-up-wordpress/
rewrite !\.(js|ico|gif|jpg|png|css|pdf|mov|mp3|eot|svg|ttf|woff|otf|txt|swf)$ /index.php break;
rewrite /wp-admin/$ /wp-admin/index.php break;
rewrite /$ /index.php break;
# enable gzip compression
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_types text/plain application/x-javascript text/xml text/css;
gzip_vary on;
# end gzip configuration
location ~* ^/(.*\.(js|css|png|jpg|jpeg|gif|ico))$ {
expires 2w;
log_not_found off;
}
@mbrughi
Copy link
Author

mbrughi commented Sep 30, 2022

Another tested configuration (not valid for all websites... please test first)

if (!-e $request_filename) {
	rewrite ^(.+)$ /index.php?q=$1 last;
}
location ~* \.(?:ico|css|js|gif|jpe?g|png|pdf|svg|woff|mp4|webm)$ {
	expires 30d;
	add_header Pragma public;
	add_header Cache-Control "public";
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment