Difference between revisions of "Sentora SSL Letsencrypt"

From MS Computech
Jump to: navigation, search
Line 35: Line 35:
 
SSLCompression off
 
SSLCompression off
 
</pre>
 
</pre>
 +
Redirect http to https
 +
<pre>
 +
# DOMAIN: siamtools.com
 +
# PORT FORWARD FROM 80 TO: 443
 +
<virtualhost *:80>
 +
ServerName siamtools.com
 +
ServerAlias www.siamtools.com
 +
ServerAdmin [email protected]
 +
RewriteEngine on
 +
ReWriteCond %{SERVER_PORT} !^443$
 +
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
 +
</virtualhost>
 +
# END DOMAIN: siamtools.com
 +
</pre>
 +
 
<pre>
 
<pre>
 
php -q /etc/sentora/panel/bin/daemon.php
 
php -q /etc/sentora/panel/bin/daemon.php

Revision as of 10:19, 21 January 2017

วิธีการติดตั้ง SSL Letsencrypt บน Centos 7 Sentora

yum install git mod_ssl openssl python-certbot-apache
nano /etc/httpd/conf.d/ssl.conf

nano /etc/httpd/conf.d/ssl.conf

#Listen 443 https
git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
./letsencrypt-auto --help
service httpd stop
./letsencrypt-auto certonly --standalone -d domain.com -d www.domain.com -d images.domain.com -d panel.domain.com
service httpd start

Changing Sentora port: On Sentora Panel go to Admin -> Module Admin -> Apache Config > Override a Virtualhost [Select VHost] -> Tick Port Override. Forward Port 80 to Overriden Port: 443 Custom Entry:

SSLEngine on
SSLProtocol ALL -SSLv2 -SSLv3
SSLHonorCipherOrder On
SSLCipherSuite ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
SSLCertificateFile /etc/letsencrypt/live/domain.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/domain.com/chain.pem
# Keeping bellow for future upgrades.
# Requires Apache >= 2.4
SSLCompression off

Redirect http to https

# DOMAIN: siamtools.com
# PORT FORWARD FROM 80 TO: 443
<virtualhost *:80>
ServerName siamtools.com
ServerAlias www.siamtools.com
ServerAdmin [email protected]
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
</virtualhost>
# END DOMAIN: siamtools.com
php -q /etc/sentora/panel/bin/daemon.php
service apache2 restart

Rewrite .htaccess http to https

RewriteEngine On

# If your opencart installation does not run on the main web folder make sure y$

RewriteBase /

####################
#First rewrite any request to the wrong domain to use the correct one (here www$
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

#Now, rewrite to HTTPS:
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
<pre>

Your domain should now be secured by SSL.
You can test it here: https://www.ssllabs.com/ssltest/