2

i have installed SSL. and trying to redirect all HTTP request to HTTPS.

i came across this code snippet,

<VirtualHost *:80>
    ServerName www.example.com
    Redirect / https://www.example.com/
</VirtualHost>

<VirtualHost *:443>
    ServerName www.example.com
    # ... SSL configuration goes here
</VirtualHost>

i will add it at httpd.conf (i am using apache from the wamp bundle)

my question is what should be there in "# ... SSL Configuration goes here"

i am using AWS certificate manager with Elastic Load Balancer

Thanks

  • aws official docs are awesome . they will guide you step by step https://docs.aws.amazon.com/acm/latest/userguide/setup-website.html . – Nirmal Dey Sep 10 '17 at 06:14

2 Answers2

0

You need the http to https redirection in apache configuration.

my question is what should be there in "# ... SSL Configuration goes here"?

You don't need to add any SSL configuration since you can attach the SSL certificate to the ELB with AWS Certificates Manager, while terminating the SSL connection at the ELB.

You can use http to communicate from ELB to the EC2 instance.

Ashan
  • 18,898
  • 4
  • 47
  • 67
  • i have already attached the SSL TO ELB and ELB to my domain by route53 . Now for redirection i came across the above code snippet so i should copy this snippet directly just by changing my server name ? –  Sep 10 '17 at 14:21
  • You can use the snippet but don't hardcode the domain name in the config. You can redirect to the https url constructed with HTTP_HOST variable. – Ashan Sep 10 '17 at 19:15
0

If you use AWS ELB at ELB https will get terminated so just needs to add ssl certs to ELB note from ELB to your EC2 will not be under https(i.e ssl encrypted)

if you use https Refer AWS documentation

refer for non AWS accounts

<VirtualHost *:443>
ServerName example.com
DocumentRoot "/var/www/html/"
SSLEngine on
SSLCertificateFile "/etc/ssl/certs/example.crt"
SSLCertificateKeyFile "/etc/ssl/certs/example.key"