Created
June 18, 2016 09:11
-
-
Save kanibaspinar/56154f14446b0bd29f38ae6581e721ba to your computer and use it in GitHub Desktop.
Wordpress security and performance optimization with Nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##Please create a file folder named wordpress.conf in /etc/nginx/conf.d insert into these codes## | |
# Common deny or internal locations, to help prevent access to not-public areas | |
location ~* wp-admin/includes { deny all; } | |
location ~* wp-includes/theme-compat/ { deny all; } | |
location ~* wp-includes/js/tinymce/langs/.*\.php { deny all; } | |
location /wp-content/ { internal; } | |
location /wp-includes/ { internal; } | |
location ~ /(\.|wp-config.php|readme.html|license.txt) { deny all; } | |
# Add trailing slash to */wp-admin requests. | |
# rewrite /wp-admin$ $scheme://$host$uri/ permanent; | |
# Prevent any potentially-executable files in the uploads directory from being executed | |
# by forcing their MIME type to text/plain | |
location ~* ^/wp-content/uploads/.*.(html|htm|shtml|php|js|swf)$ { | |
types { } | |
default_type text/plain; | |
} | |
location ~* ^/wp-includes/uploads/.*.(html|htm|shtml|php|js|swf)$ { | |
types { } | |
default_type text/plain; | |
} | |
location ~* ^/wp-content/cache/page_enhanced.*html$ { | |
expires max; | |
charset utf-8; | |
add_header Vary "Accept-Encoding, Cookie"; | |
add_header Pragma public; | |
add_header Cache-Control "public, must-revalidate, proxy-revalidate"; | |
} | |
location ~* ^/wp-content/cache/page_enhanced.*gzip$ { | |
expires max; | |
gzip off; | |
types {} | |
charset utf-8; | |
default_type text/html; | |
add_header Vary "Accept-Encoding, Cookie"; | |
add_header Content-Encoding gzip; | |
add_header Pragma public; | |
add_header Cache-Control "public, must-revalidate, proxy-revalidate"; | |
} | |
##Have a nice day KBSP## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment