Last active
March 31, 2017 23:55
-
-
Save youhide/1c6505dddb4a835cb10f0a091bac9edb to your computer and use it in GitHub Desktop.
Pass environment variable to NGINX fastcgi on AWS ElasticBeanstalk
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
#!/usr/bin/env bash | |
. /opt/elasticbeanstalk/support/envvars | |
cp /etc/nginx/fastcgi_params.default /etc/nginx/fastcgi_params | |
. /opt/elasticbeanstalk/bin/get-config environment | python -c "import json,sys; obj=json.load(sys.stdin); f = open('/etc/nginx/fastcgi_params', 'a'); f.write('\n'.join(map(lambda x: 'fastcgi_param ' + x[0] + ' ' + x[1] + ';', obj.iteritems())))" | |
service httpd stop | |
service nginx restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment