Skip to content

Instantly share code, notes, and snippets.

@tigris
Created January 18, 2016 08:03
Show Gist options
  • Select an option

  • Save tigris/d35c2428c86a49f89c74 to your computer and use it in GitHub Desktop.

Select an option

Save tigris/d35c2428c86a49f89c74 to your computer and use it in GitHub Desktop.

Revisions

  1. Danial Pearce created this gist Jan 18, 2016.
    6 changes: 6 additions & 0 deletions .ebextensions__02_nginx_fix.config
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    ---
    container_commands:
    10_copy:
    command: sudo cp -f config/nginx.conf /etc/nginx/conf.d/webapp.conf
    20_reload:
    command: sudo service nginx reload
    25 changes: 25 additions & 0 deletions config__nginx.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    upstream my_app {
    server unix:///var/run/puma/my_app.sock;
    }

    server {
    listen 80;
    server_name _ localhost; # need to listen to localhost for worker tier

    root /var/app/current/public;

    location / {
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    if (!-f $request_filename) {
    proxy_pass http://my_app; # match the name of upstream directive which is defined above
    break;
    }

    gzip_static on;
    gzip on;
    expires max;
    add_header Cache-Control public;
    }
    }