Last active
June 28, 2018 05:37
-
-
Save solastley/6ed955eda29754a72d892eeaf8b04c6b to your computer and use it in GitHub Desktop.
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: | |
"/home/ec2-user/setup.sh": | |
mode: "000755" | |
owner: root | |
group: root | |
content: | | |
#!/bin/bash | |
# access AWS environment variables | |
source /opt/python/current/env | |
if [ "$PROD" = "True" ] | |
then | |
# create Apache configuration file | |
cat <<EOT > /etc/httpd/conf.d/ssl_rewrite.conf | |
# force HTTP traffic to HTTPS | |
RewriteEngine On | |
<If "-n '%{HTTP:X-Forwarded-Proto}' && %{HTTP:X-Forwarded-Proto} != 'https'"> | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] | |
</If> | |
EOT | |
# set appropriate permissions | |
chown root:root /etc/httpd/conf.d/ssl_rewrite.conf | |
chmod 000755 /etc/httpd/conf.d/ssl_rewrite.conf | |
fi | |
container_commands: | |
set_up: | |
command: /home/ec2-user/setup.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment