Skip to content

Instantly share code, notes, and snippets.

@othree
Last active March 10, 2016 06:22
Show Gist options
  • Save othree/05d193acbcec49a15732 to your computer and use it in GitHub Desktop.
Save othree/05d193acbcec49a15732 to your computer and use it in GitHub Desktop.
error_page 404 /about/404/;
location / {
root /var/www/blog;
index index.php;
location ~* \.(js|css|jpg|jpeg|gif|png|ico|xsl)$ {
location ~* \.(js|css|xsl)$ {
expires 1d;
}
location ~* \.(jpg|jpeg|gif|png|ico)$ {
expires 15d;
}
# no rewrite
}
location ~* ^/feeds/(.*).(xml|rdf)$ {
# no rewrite
}
rewrite ^([^.]*[^/])$ $1/ permanent;
rewrite ^/log/(\d\d\d\d)/(\d\d)/(\d\d)/$ "/log/$1/$2/#date-$1-$2-$3" permanent;
set $f $uri;
if (-f "${request_filename}index.xml") {
set $f "${uri}index.xml";
rewrite ^(.*)$ "${uri}index.xml" last;
}
rewrite ^(.*)/$ $1;
if (-f "${request_filename}.xml") {
set $f "${uri}.xml";
rewrite ^(.*)$ "${uri}.xml" last;
}
return 404;
location ~* \.xml$ {
rewrite ^(.*)$ /index.php?$f last;
}
location ~* \.php$ {
try_files $uri =404;
expires 1h;
add_header Accept-CH "DPR, Downlink";
add_header Content-Security-Policy "default-src 'none'; script-src 'self' *.twitter.com *.disqus.com *.disquscdn.com ssl.google-analytics.com speakerdeck.com apis.google.com; style-src 'self' platform.twitter.com *.disquscdn.com; img-src 'self' feeds.feedburner.com pbs.twimg.com *.twitter.com *.disqus.com *.disquscdn.com *.static.flickr.com *.static.flickr.com *.staticflickr.com ssl.google-analytics.com data:; frame-src embed-ssl.ted.com syndication.twitter.com disqus.com *.google.com www.facebook.com platform.twitter.com speakerdeck.com www.youtube.com http://embed.ted.com; font-src themes.googleusercontent.com; connect-src 'self' *.disqus.com";
add_header Link "</stylesheets/bootstrap/css/bootstrap.min.css>; rel=preload; as=stylesheet";
add_header Link "</stylesheets/bootstrap/css/bootstrap-responsive.min.css>; rel=preload; as=stylesheet";
add_header Link "</stylesheets/othree.min.css>; rel=preload; as=stylesheet";
include fastcgi.conf;
fastcgi_param REQUEST_URI $request_URI;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment