Created
February 16, 2020 12:25
-
-
Save genediazjr/e1f9dbb5008d6d3b66c58597ee8d1bca to your computer and use it in GitHub Desktop.
.ebextensions
This file contains 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: | |
"/etc/nginx/conf.d/proxy.conf" : | |
mode: "000755" | |
owner: root | |
group: root | |
content: | | |
client_max_body_size 50M; |
This file contains 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: | |
"/tmp/.npmrc": | |
content: | | |
//registry.npmjs.org/:_authToken=${NPM_TOKEN} | |
unsafe-perm=true |
This file contains 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: | |
"/tmp/45_nginx_https_rw.sh": | |
owner: root | |
group: root | |
mode: "000644" | |
content: | | |
#! /bin/bash | |
CONFIGURED=`grep -c "return 301 https" /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf` | |
if [ $CONFIGURED = 0 ] | |
then | |
sed -i '/listen 8080;/a \ if ($http_x_forwarded_proto = "http") { return 301 https://$host$request_uri; }\n' /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf | |
logger -t nginx_rw "https rewrite rules added" | |
exit 0 | |
else | |
logger -t nginx_rw "https rewrite rules already set" | |
exit 0 | |
fi | |
container_commands: | |
00_appdeploy_rewrite_hook: | |
command: cp -v /tmp/45_nginx_https_rw.sh /opt/elasticbeanstalk/hooks/appdeploy/enact | |
01_configdeploy_rewrite_hook: | |
command: cp -v /tmp/45_nginx_https_rw.sh /opt/elasticbeanstalk/hooks/configdeploy/enact | |
02_rewrite_hook_perms: | |
command: chmod 755 /opt/elasticbeanstalk/hooks/appdeploy/enact/45_nginx_https_rw.sh /opt/elasticbeanstalk/hooks/configdeploy/enact/45_nginx_https_rw.sh | |
03_rewrite_hook_ownership: | |
command: chown root:users /opt/elasticbeanstalk/hooks/appdeploy/enact/45_nginx_https_rw.sh /opt/elasticbeanstalk/hooks/configdeploy/enact/45_nginx_https_rw.sh |
This file contains 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
container_commands: | |
01_nginx_websocket_support: | |
command: | | |
sed -i '/\s*proxy_set_header\s*Connection/c \ | |
proxy_set_header Upgrade $http_upgrade;\ | |
proxy_set_header Connection "upgrade";\ | |
' /tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment