Setup HTTPS in CentOS
From HostThyself
In the default install of CentOS Apache, SSL or https may not be setup.
To setup SSL, simply follow these steps.
Install mod_ssl
yum install mod_ssl.i386
[edit] Redirect all connection to HTTPS
In some cases, you may want to redirect all non-secure http connection to https connection (for example an admin server).
- Edit the Apache configuration file
vi /etc/httpd/conf/httpd.conf
- Add the following
RewriteEngine On
RewriteCond %{HTTPS} On
RewriteRule (.*) https://example.com%{REQUEST_URI}
RewriteRule (.*) https://example.com$1 [R,L]
- Restart Apache
/etc/init.d/httpd restart
