Skip to content

Instantly share code, notes, and snippets.

@andreferraro
Created July 23, 2015 05:52
Show Gist options
  • Save andreferraro/1e23942253722bac793d to your computer and use it in GitHub Desktop.
Save andreferraro/1e23942253722bac793d to your computer and use it in GitHub Desktop.
TEMPLATE_CONFIG_FILE = """
#AUTOMATICALLY GENERATED - DO NO EDIT!
user %(user)s %(user)s;
pid /var/run/nginx.pid;
worker_processes %(workers)s;
worker_rlimit_nofile 100000;
events {
worker_connections 4096;
include /etc/nginx.custom.events.d/*.conf;
}
http {
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
error_log %(log_root)s/error.log warn;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
client_max_body_size 128m;
keepalive_timeout 65;
client_header_timeout 20;
client_body_timeout 20;
reset_timedout_connection on;
send_timeout 20;
types_hash_max_size 2048;
# PageSpeed
pagespeed on;
pagespeed FileCachePath "/var/cache/ngx_pagespeed/";
pagespeed EnableFilters combine_css,combine_javascript;
pagespeed XHeaderValue "Powered by Enso Extreme IDC";
gzip on;
gzip_disable "msie6";
gzip_proxied any;
gzip_min_length 256;
gzip_comp_level 4;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js;
server_names_hash_bucket_size 1024;
include mime.conf;
charset UTF-8;
open_file_cache max=100000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
server_tokens off;
include proxy.conf;
include fcgi.conf;
include conf.d/*.conf;
include /etc/nginx.custom.d/*.conf;
}
include /etc/nginx.custom.global.d/*.conf;
""" % {
'workers': multiprocessing.cpu_count(),
'log_root': '/var/log/nginx',
'user': 'www-data',
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment