Last active
December 13, 2017 06:43
-
-
Save joshleichtung/5c3597756497a2ea68cd7d85df06e8d2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
files: # this is set up for where to create the new file from the .ebextensions during environment setup | |
"/etc/nginx/conf.d/01_webapp.conf": | |
mode: "000644" | |
owner: root | |
group: root | |
content: | # Copy the contents of your original /etc/nginx/conf.d/webapp.conf file below. | |
# Comments are provided where changes or additions are required | |
upstream app_name { # the name can be anything other than my_app, which is used in the default webapp.conf file | |
server unix:///var/run/puma/my_app.sock; | |
} | |
server { | |
listen 80; | |
server_name _ localhost; # need to listen to localhost for worker tier | |
location / { | |
proxy_pass http://apprenticeshipio; # 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 { | |
alias /var/app/current/public/assets; | |
gzip_static on; | |
gzip on; | |
expires max; | |
add_header Cache-Control public; | |
} | |
location /public { | |
alias /var/app/current/public; | |
gzip_static on; | |
gzip on; | |
expires max; | |
add_header Cache-Control public; | |
} | |
# The other lines can be copied from your /etc/nginx/conf.d/webapp.conf file, | |
# but this is the location directive that makes makes the webpack js file serving working. | |
location /packs { | |
alias /var/app/current/public/packs; | |
gzip_static on; | |
gzip on; | |
expires max; | |
add_header Cache-Control public; | |
} | |
} | |
# This reloads the server, which will both make the changes take affect and makes sure the config is valid when you deploy | |
container_commands: | |
01_reload_nginx: | |
command: "sudo service nginx reload" | |
I got error:
ElasticBeanstalk::ExternalInvocationError,
{"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"container_command 01_reload_nginx in .ebextensions/01_elastic_beanstalk_webapp.config failed. For more detail, check /var/log/eb-activity.log using console or EB CLI","returncode":7,"events":[]}]}
because of:
container_commands:
01_reload_nginx:
command: "sudo service nginx reload"
although if I ssh into the instance and execute sudo service nginx reload
it will be executed normally..
Any idea?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the file!
One little observation. There's a mismatch with your:
and the location proxy pass: