-
-
Save ebarault/88b7b9704d6a30d2f55e98f78a21f4dd to your computer and use it in GitHub Desktop.
Elastic Beanstalk NGINX rewrite http to https using .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/00_elastic_beanstalk_proxy.conf": | |
mode: "000755" | |
owner: root | |
group: root | |
content: | | |
server { | |
listen 80; | |
gzip on; | |
if ($http_x_forwarded_proto != 'https') { | |
rewrite ^(.*) https://$host$1 redirect; | |
} | |
location / { | |
proxy_pass http://docker; | |
proxy_http_version 1.1; | |
proxy_set_header Connection $connection_upgrade; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
place this in the
.ebextensions
folder and zip this folder with yourDockerrun.aws.json
NOTE:
Dockerrun.aws.json
and.ebextensions
folder should be at the root of the zip archiveadd the following lines to your
eb_config.yml
file:eb deploy