Dear Community
I hope you are doing well today.
May I kindly ask your assistance since HTTPD is not my strong point? I have several virtual host conf files that have the structure below. I am now trying to change them so that incoming visitors from port 80 are being redirected to port 443:
<VirtualHost *>
ServerName subdomain.domain.ac.za
DocumentRoot "/var/www/ subdomain.domain.ac.za/public_html"
<Directory "/var/www/subdomain.domain.ac.za/public_html">
Options Indexes FollowSymLinks MultiViews
# AllowOverride controls what directives may be placed in .htaccess files.
AllowOverride All
# Controls who can get stuff from this server file
Order allow,deny
Allow from all
</Directory>
<IfModule mpm_peruser_module>
ServerEnvironment apache apache
</IfModule>
</VirtualHost>
If a change it to this structure below to redirect the traffic from port 80 to 443, I am getting the error message that connection is not private and if I continue I am getting the default Apache page instead of the intended site’s home page.
<VirtualHost *>
ServerName subdomain.domain,ac,za
SSLEngine On
SSLCertificateKeyFile /etc/pki/tls/certs/cnrstone/xxxxxx.key
SSLCertificateFile /etc/pki/tls/certs/cnrstone/ xxxxxx.crt
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME} [R,L]
DocumentRoot "/var/www/ subdomain.domain.ac.za/public_html"
<Directory "/var/www/ subdomain.domain.ac.za/public_html">
Options Indexes FollowSymLinks MultiViews
# AllowOverride controls what directives may be placed in .htaccess files.
AllowOverride All
# Controls who can get stuff from this server file
Order allow,deny
Allow from all
</Directory>
<IfModule mpm_peruser_module>
ServerEnvironment apache apache
</IfModule>
</VirtualHost>
If I change it to this structure below, the page is presented when using the url https://subdomain.domain.ac.za/ but not http://subdomain.domain.ac.za/
<VirtualHost *:443>
ServerName subdomain.domain.ac.za
SSLEngine On
SSLCertificateKeyFile /etc/pki/tls/certs/cnrstone/ xxxxxx.key
SSLCertificateFile /etc/pki/tls/certs/cnrstone/ xxxxxx.crt
DocumentRoot "/var/www/ subdomain.domain.ac.za/public_html"
<Directory "/var/www/ subdomain.domain.ac.za/public_html">
Options Indexes FollowSymLinks MultiViews
# AllowOverride controls what directives may be placed in .htaccess files.
AllowOverride All
# Controls who can get stuff from this server file
Order allow,deny
Allow from all
</Directory>
<IfModule mpm_peruser_module>
ServerEnvironment apache apache
</IfModule>
</VirtualHost>
Last virhost structure that I tried is similar to the one below. When applying these changes to other virtual hosts files, I am not re-directed to the right site, i.e. url https://subdomain1.domain.ac.za gets redirected to https://subdomain.domain.ac.za.
<VirtualHost *:80>
ServerName subdomain.domain.ac.za
DocumentRoot "/var/www/subdomain.cornerstone.ac.za/public_html"
Redirect permanent / subdomain.domain.ac.za
</VirtualHost>
<VirtualHost _default_:443>
ServerName subdomain.domain.ac.za
SSLEngine On
SSLCertificateKeyFile /etc/pki/tls/certs/cnrstone/ xxxxxx.key
SSLCertificateFile /etc/pki/tls/certs/cnrstone/ xxxxxx.crt
DocumentRoot "/var/www/subdomain.domain.ac.za/public_html"
<Directory "/var/www/ subdomain.domain.ac.za/public_html">
Options Indexes FollowSymLinks MultiViews
# AllowOverride controls what directives may be placed in .htaccess files.
AllowOverride All
# Controls who can get stuff from this server file
Order allow,deny
Allow from all
</Directory>
<IfModule mpm_peruser_module>
ServerEnvironment apache apache
</IfModule></VirtualHost>
In addition, I have received serveral .crt files for a wild card certificate issues by Comodo. Do I have to include them all and how will a go about doing so, if I have to?
Thank you in advance.
Kind Regards
Leon