Redirect http to https , what is ssl configuration?

88 views Asked by At

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

2

There are 2 answers

2
Ashan On BEST ANSWER

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.

0
Sumith Senarathne On

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"