Skip to content

Instantly share code, notes, and snippets.

@naps62
Last active August 29, 2015 14:07
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 naps62/4f137fa52d501c902491 to your computer and use it in GitHub Desktop.
Save naps62/4f137fa52d501c902491 to your computer and use it in GitHub Desktop.
Examples for Provision talk @ Code Week
upstream foobar {
server unix:///var/www/foobar/shared/sockets/puma.sock;
}
server {
server_name www.foobar.com;
return 301 $scheme://foobar.com$request_uri;
}
server {
listen 80;
server_name foobar.com;
rewrite ^ https://$host$request_uri permanent;
}
server {
listen 443;
ssl on;
ssl_certificate /var/www/foobar/shared/ssl/yniche.crt;
ssl_certificate_key /var/www/foobar/shared/ssl/yniche.key;
server_name foobar.com;
root /var/www/foobar/current/public;
try_files $uri/index.html $uri.html $uri @foobar;
error_page 404 500 /500.html;
location = /500.html {
root /var/www/foobar/current/public;
}
location / {
proxy_pass http://foobar;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~* ^/(system|uploads|assets)/ {
expires 1y;
add_header Cache-Control public;
add_header Last-Modified "";
add_header ETag "";
break;
}
}
check process nodejs with pidfile "/var/run/foobar.pid"
start program = "/sbin/start foobar"
stop program = "/sbin/stop foobar"
if failed port 8000 protocol HTTP
request /
with timeout 10 seconds
then restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment