Skip to content

Instantly share code, notes, and snippets.

@RubenVerborgh
Last active January 3, 2017 13:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RubenVerborgh/6d4ac975f0f36b6d296295dd2160c50f to your computer and use it in GitHub Desktop.
Save RubenVerborgh/6d4ac975f0f36b6d296295dd2160c50f to your computer and use it in GitHub Desktop.
NGINX config for fragments.dbpedia.org
proxy_cache_path /mnt/tmp/cache/nginx levels=1:2 keys_zone=fragments-cache:100m max_size=20g inactive=600m;
proxy_temp_path /mnt/tmp/nginx;
upstream fragments-node {
server 127.0.0.1:4000;
}
server {
server_name fragments.dbpedia.org;
if ($request_method !~ ^(GET|HEAD|OPTIONS)$) {
return 405;
}
location /assets/ {
proxy_pass http://fragments-node$request_uri;
proxy_pass_header Server;
expires 3w;
proxy_cache fragments-cache;
proxy_cache_key "$request_uri";
proxy_cache_valid 200 404 60m;
proxy_cache_bypass $arg_nocache $http_pragma;
}
location / {
proxy_pass http://fragments-node$request_uri;
proxy_set_header Host $http_host;
proxy_pass_header Server;
expires 7d;
proxy_cache fragments-cache;
proxy_cache_key "$request_uri $http_accept";
proxy_cache_valid 200 302 404 60m;
proxy_cache_bypass $arg_nocache $http_pragma;
}
}
user www-data;
worker_processes 8;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# For large headers (due to Memento)
proxy_buffer_size 128k;
proxy_buffers 4 256k;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Logging Settings
log_format fragments '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" "$http_accept" $upstream_cache_status';
access_log /data/log/nginx/access.log fragments buffer=4k;
error_log /data/log/nginx/error.log;
# Gzip Settings
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript
application/javascript application/ld+json text/turtle image/svg+xml application/trig application/n-triples application/n-quads;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment