Pages

Wednesday, February 24, 2016

http to https auto redirect for webmin virtualhosts



*** WE have a site  http://mail.tayabkhan.com and we need to redirect https://mail.tayabkhan.com

IF we use virtualmin then edit Virtual Host-> eanble features -> tick  SSL website enabled?
If  there is not virtualmin, webmin then generate ssl.cert and ssl.key and use in virtualhost.

Edit httpd.conf file...

NameVirtualHost *:80
NameVirtualHost 192.168.10.10:443


<VirtualHost 192.168.10.10:443>
ServerAdmin webmaster@tayabkhan.com
ServerName  mail.tayabkhan.com
DocumentRoot /home/tayabkhan/public_html
ErrorLog /var/log/virtualmin/tayabkhan.com_error_log
CustomLog /var/log/virtualmin/tayabkhan.com_access_log combined


    SSLEngine on
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile    /home/tayabkhan/ssl.cert
    SSLCertificateKeyFile /home/tayabkhan/ssl.key
    SetEnvIf User-Agent ".*MSIE.*" \
        nokeepalive ssl-unclean-shutdown \
        downgrade-1.0 force-response-1.0
</VirtualHost>

<VirtualHost *:80>
    ServerName mail.tayabkhan.com
    Redirect / https://mail.tayabkhan.com/
</VirtualHost>

<IfDefine SSL>
<IfDefine !NOSSL>


</IfDefine>
</IfDefine>