#>cd /usr/share/letsencrypt
#>./letsencrypt-auto --apache -d greencom.com.tw -d www.greencom.com.tw
this is ok for https://www.greencom.com.tw and https://greencom.com.tw
--------------for .conf
NameVirtualHost 59.125.229.2:80
# Virtual host Virtual Host greencom.com.tw
<VirtualHost 59.125.229.2:80>
ServerAdmin root@greencom.com.tw
DocumentRoot /var/www/html
ServerName www.greencom.com.tw
ServerAlias greencom.com.tw
RewriteEngine on
RewriteCond %{SERVER_NAME} =greencom.com.tw [OR]
RewriteCond %{SERVER_NAME} =www.greencom.com.tw
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [L,NE,R=permanent]
</VirtualHost>
--------------------------for le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost 59.125.229.2:443>
ServerAdmin root@greencom.com.tw
DocumentRoot /var/www/html
ServerName www.greencom.com.tw
ServerAlias greencom.com.tw
RewriteEngine On
# Redirect 301 / https://www.greencom.com.tw
RewriteCond %{HTTP_HOST} ^greencom.com\.tw$ [NC]
RewriteRule ^(.*)$ http://www.greencom.com.tw/$1 [R=301,L]
SSLCertificateFile /etc/letsencrypt/live/greencom.com.tw/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/greencom.com.tw/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/greencom.com.tw/chain.pem
</VirtualHost>
</IfModule>
-----------for httpd.conf
ServerName greencom.com.tw:80