Skip to content

Instantly share code, notes, and snippets.

@mattapayne
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattapayne/215657dddca386d2dd68 to your computer and use it in GitHub Desktop.
Save mattapayne/215657dddca386d2dd68 to your computer and use it in GitHub Desktop.
OSX Yosemite Thinkific Nginx Conf
worker_processes 10;
pid /var/run/nginx.pid;
events
{
worker_connections 1024;
}
http {
include /usr/local/etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay off;
server_tokens off;
charset utf-8;
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# configure log format like to Apache's "combined" log format
log_format main
'$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_cookie"';
# default log files
error_log /var/log/nginx/error.log notice;
access_log /var/log/nginx/access.log main;
upstream unicorn_server {
# This is the socket we configured in unicorn.rb
server unix:/Users/mattpayne/code/thinkific/tmp/sockets/unicorn.sock
fail_timeout=0;
}
server {
listen 80;
listen 443 default ssl;
ssl_certificate /Users/mattpayne/thinkific_dev_ssl/lvh.me.cert;
ssl_certificate_key /Users/mattpayne/thinkific_dev_ssl/lvh.me.key;
client_max_body_size 4G;
large_client_header_buffers 4 32k;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
ssl_verify_client off;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
server_name lvh.me;
keepalive_timeout 65;
# Location of our static files
root /Users/mattpayne/code/thinkific/public;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
# If you don't find the filename in the static files
# Then request it from the unicorn server
if (!-f $request_filename) {
proxy_pass http://unicorn_server;
break;
}
}
location ~* \.(eot|ttf|woff)$ {
add_header Access-Control-Allow-Origin *;
}
# this rewrites all the requests to the maintenance.html
# page if it exists in the doc root. This is for capistrano's
# disable web task
if (-f $document_root/system/maintenance.html)
{
rewrite ^(.*)$ /system/maintenance.html last;
break;
}
error_page 500 502 503 504 /500.html;
location = /500.html
{
root /Users/mattpayne/code/thinkific/public;
}
error_page 404 /404.html;
location = /404.html
{
root /Users/mattpayne/code/thinkific/public;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment