Skip to content

Instantly share code, notes, and snippets.

@biot023
Created October 3, 2014 14:06
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 biot023/336e9cc49baae75bb3f6 to your computer and use it in GitHub Desktop.
Save biot023/336e9cc49baae75bb3f6 to your computer and use it in GitHub Desktop.
00-server-setup.conf
files:
"/tmp/00-elastic-beanstalk.conf":
mode: "000644",
owner: root,
group: root,
content: |
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
client_max_body_size 10M;
location / {
proxy_pass http://my_app; # match the name of upstream directive which is defined above
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~ "^/assets/" {
root /var/app/current/public;
gzip_static on;
expires max;
add_header Cache-Control public;
}
}
"/opt/elasticbeanstalk/hooks/appdeploy/post/99-start-nginx.sh":
mode: "000744"
owner: root
group: root
content: |
#!/usr/bin/env bash
cp /tmp/00-elastic-beanstalk.conf /etc/nginx/conf.d/webapp.conf
service nginx restart
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment