I'm trying to configure my spring boot app on apache2 with a SSL certificate but i cannot understand if all the steps i'm doing are correct, before putting it in production. I need to use https and redirect all calls from 80 to 443
So, my jar application is deployed on port 8080, so I have first edited my /etc/apache2/sites_available/000-default.conf
in this way
<VirtualHost *:80>
ServerName www.example.com
ServerAdmin webmaster@localhost
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPreserveHost On
ProxyPass / http://localhost:8080/
</VirtualHost>
And this was working great when i needed just plain http
Now i have a CA-certificate, i put the crt and the key in /etc/apache2/ssl/certs/
and /etc/apache2/ssl/private/
and edited the
default-ssl.conf
in this way
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/xxxxxxxxxxxx.crt
SSLCertificateKeyFile /etc/ssl/private/yyyyyyyyyyy.key
SSLCertificateChainFile /etc/apache2/ssl/certs/sf_bundle-g2-g1.crt
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
</VirtualHost>
</IfModule>
In this way, i should have enabled SSL on Apache, right? Now i need to understand how to redirect all call from 80 to 443, and if the workflow i followed is correct