I am creating a web page with slackware 15 with a local server in apache, and I am redirecting the page with the protocol from http to https with an ssl certificate created with the command:
openssl req -new -newkey rsa:4096 -x509 -sha256 -days 365 -nodes -out apache-certificate.crt -keyout apache.key
to redirect it, create the virtual hosts in the file /etc/httpd/extra/httpd-vhosts.conf but the problem occurs that it is redirected but it does not show the page in the browser and the ssl certificate either, the configuration I have is the following:
<VirtualHost *:80>
ServerName manu2001.com
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]
</VirtualHost>
<VirtualHost *:443>
ServerAdmin root@localhost
DocumentRoot "/var/www/ejemplo.com/public_html"
ServerName manu2001.com
ServerAlias www.jos-ejemplo.com
ErrorLog "/var/log/httpd/dummy-host2.example.com-error_log"
CustomLog "/var/log/httpd/dummy-host2.example.com-access_log" common
<directory "/var/www/ejemplo.com/public_html">
Require all granted
</directory>
SSLCertificateFile /etc/apache2/certificate/apache-certificate.crt
SSLCertificateKeyFile /etc/apache2/certificate/apache.key
</VirtualHost>
The page is displayed correctly without redirecting it to https and only having the basic configuration.
in the browser it appears like this