Skip to content

Instantly share code, notes, and snippets.

@MeenachiSundaram
Last active October 3, 2016 12:28
Show Gist options
  • Save MeenachiSundaram/a0a9ef0bbc17df777faa066835680aa1 to your computer and use it in GitHub Desktop.
Save MeenachiSundaram/a0a9ef0bbc17df777faa066835680aa1 to your computer and use it in GitHub Desktop.
/etc/nginx/sites-available/default
server {
listen 0.0.0.0:80;
server_name awsaudit.com www.awsaudit.com;
access_log /var/log/nginx/awsaudit.com.access.log;
root /var/www/schoolofdevops/www;
try_files $uri /index.php?$args;
set $cache_uri $request_uri;
# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
set $cache_uri 'null cache';
}
if ($query_string != "") {
set $cache_uri 'null cache';
}
# Don't cache uris containing the following segments
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
set $cache_uri 'null cache';
}
# Don't use the cache for logged in users or recent commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
set $cache_uri 'null cache';
}
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
# Mitigate https://httpoxy.org/ vulnerabilities
fastcgi_param HTTP_PROXY "";
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment