Skip to content

Instantly share code, notes, and snippets.

@ar-jan
Forked from omega8cc/gist:1677835
Last active December 25, 2015 09:39
Show Gist options
  • Save ar-jan/6955558 to your computer and use it in GitHub Desktop.
Save ar-jan/6955558 to your computer and use it in GitHub Desktop.
omega8cc's nginx include example for wordpress, updated for Tiny Tiny RSS.
#######################################################
### nginx.conf site tt-rss vhost include start
### create as /var/aegir/config/includes/nginx_ttrss_include.conf
#######################################################
###
### deny crawlers without 403 response
###
if ($http_user_agent ~* (HTTrack|HTMLParser|libwww|wget) ) {
return 444;
}
###
### deny access to .htaccess
###
location ~ \.htaccess$ {
deny all;
}
###
### catch all unspecified requests
###
location / {
try_files $uri $uri/ @ttrss;
}
###
### send all not cached requests to tt-rss with clean URLs support
###
location @ttrss {
rewrite . /index.php last;
}
###
### send all non-static requests to php-fpm
###
location ~ \.php$ {
try_files $uri @ttrss; ### check for existence of php file first
fastcgi_pass unix:/var/run/www54.fpm.socket; ### php-fpm listening socket
}
###
### serve & no-log static files & images directly, without all standard drupal rewrites, php-fpm etc.
###
location ~* ^.+\.(jpg|jpeg|gif|png|ico|swf|pdf|doc|xls|tiff|tif|txt|shtml|cgi|bat|pl|dll|asp|exe|class|css|js)$ {
access_log off;
expires 30d;
try_files $uri =404;
}
###
### serve & log bigger media/static/archive files directly, without all standard drupal rewrites, php-fpm etc.
###
location ~* ^.+\.(avi|mpg|mpeg|mov|wmv|mp3|mp4|m4a|flv|wav|midi|zip|gz|rar)$ {
expires 30d;
try_files $uri =404;
}
###
### make feeds compatible with boost caching and set correct mime type - nginx 0.7.27 or newer required with try_files support
###
location ~* \.xml$ {
charset utf-8;
types { }
default_type application/rss+xml;
try_files $uri @ttrss;
}
#######################################################
### nginx.conf site tt-rss vhost include end
#######################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment