Mẹo hướng dẫn cấu hình SSL trên localhost cho XAMPP full có cả xác thực ssl, https (ok)

https://wiki.ngoisaoso.vn/May-chu/meo-huong-dan-cau-hinh-ssl-tren-localhost-cho-xampp-329.html

https://learnemail.gitbook.io/emailphp/cach-de-gui-mail-bang-wp-smtp-tren-localhost-windows-full-pass-moi-ok

<VirtualHost test.pro:80>
  DocumentRoot "C:\xampp56\htdocs\testpro"
  RewriteEngine on
  ServerName test.pro
  ServerAlias *.test.pro
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost test.pro:443>
  DocumentRoot "C:\xampp56\htdocs\testpro"
  ServerName test.pro
  ServerAlias *.test.pro
  SSLEngine on
  SSLCertificateFile "conf/testpro/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/testpro/ssl.key/server.key"
   <Directory D:/websites/test/>  
        AllowOverride none
        Require all granted  
   </Directory>
</VirtualHost>

<VirtualHost *:80>
    RewriteEngine on
    ServerName localhost
    RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
   Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]
RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ public/$1
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.php
</IfModule>

Full


<VirtualHost *:80>
  DocumentRoot "C:\xampp82\htdocs"
  RewriteEngine on
  ServerName localhost
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost localhost:443>
  DocumentRoot "C:\xampp82\htdocs"
  ServerName localhost
  ServerAlias *.localhost
  <Directory "C:\xampp82\htdocs">
    Require all granted
  </Directory>
  SSLEngine on
  SSLCertificateFile "conf/localhost/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/localhost/ssl.key/server.key"
</VirtualHost>
<VirtualHost hanam.work:80>
  DocumentRoot "C:\xampp82\htdocs\hanam"
  RewriteEngine on
  ServerName hanam.work
  ServerAlias *.hanam.work
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost hanam.work:443>
  DocumentRoot "C:\xampp82\htdocs\hanam"
  ServerName hanam.work
  ServerAlias *.hanam.work
  SSLEngine on
  SSLCertificateFile "conf/hanam/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/hanam/ssl.key/server.key"
</VirtualHost>
<VirtualHost songkhoe.vinmec.com:80>
  DocumentRoot "C:\xampp82\htdocs\songkhoe"
  RewriteEngine on
  ServerName songkhoe.vinmec.com
  ServerAlias *.songkhoe.vinmec.com
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost songkhoe.vinmec.com:443>
  DocumentRoot "C:\xampp82\htdocs\songkhoe"
  ServerName songkhoe.vinmec.com
  ServerAlias *.songkhoe.vinmec.com
  SSLEngine on
  SSLCertificateFile "conf/songkhoe/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/songkhoe/ssl.key/server.key"
</VirtualHost>
<VirtualHost datvietcoconut.com:80>
  DocumentRoot "C:\xampp82\htdocs\datvietcoconut"
  RewriteEngine on
  ServerName datvietcoconut.com
  ServerAlias *.datvietcoconut.com
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost datvietcoconut.com:443>
  DocumentRoot "C:\xampp82\htdocs\datvietcoconut"
  ServerName datvietcoconut.com
  ServerAlias *.datvietcoconut.com
  SSLEngine on
  SSLCertificateFile "conf/datvietcoconut/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/datvietcoconut/ssl.key/server.key"
</VirtualHost>
<VirtualHost wpclidemo.dev:80>
  DocumentRoot "C:\xampp82\htdocs\wpclidemo.dev"
  RewriteEngine on
  ServerName wpclidemo.dev
  ServerAlias *.wpclidemo.dev
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost wpclidemo.dev:443>
  DocumentRoot "C:\xampp82\htdocs\wpclidemo"
  ServerName wpclidemo.dev
  ServerAlias *.wpclidemo.dev
  SSLEngine on
  SSLCertificateFile "conf/wpclidemo/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/wpclidemo/ssl.key/server.key"
</VirtualHost>
<VirtualHost style2.track360.xyz:443>
  DocumentRoot "C:\xampp82\htdocs\style2"
  ServerName style2.track360.xyz
  ServerAlias *.style2.track360.xyz
  SSLEngine on
  SSLCertificateFile "conf/styleathome/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/styleathome/ssl.key/server.key"
</VirtualHost>
<VirtualHost belongstomany.com:80>
  DocumentRoot "C:\xampp82\htdocs\belongstomany"
  RewriteEngine on
  ServerName belongstomany.com
  ServerAlias *.belongstomany.com
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost belongstomany.com:443>
  DocumentRoot "C:\xampp82\htdocs\belongstomany"
  ServerName belongstomany.com
  ServerAlias *.belongstomany.com
  SSLEngine on
  SSLCertificateFile "conf/belongstomany/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/belongstomany/ssl.key/server.key"
</VirtualHost>
<VirtualHost wpclidemo.dev:80>
  DocumentRoot "C:\xampp82\htdocs\wayarmy"
  RewriteEngine on
  ServerName oec.wayarmy.net
  ServerAlias *.oec.wayarmy.net
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost oec.wayarmy.net:443>
  DocumentRoot "C:\xampp82\htdocs\wayarmy"
  ServerName oec.wayarmy.net
  ServerAlias *.oec.wayarmy.net
  SSLEngine on
  SSLCertificateFile "conf/wayarmy/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/wayarmy/ssl.key/server.key"
</VirtualHost>
<VirtualHost cmstest.com:80>
  DocumentRoot "C:\xampp82\htdocs\cmstest"
  RewriteEngine on
  ServerName cmstest.com
  ServerAlias *.cmstest.com
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost cmstest.com:443>
  DocumentRoot "C:\xampp82\htdocs\cmstest"
  ServerName cmstest.com
  ServerAlias *.cmstest.com
  SSLEngine on
  SSLCertificateFile "conf/cmstest/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/cmstest/ssl.key/server.key"
</VirtualHost>
<VirtualHost tmp.accesspath.com:80>
  DocumentRoot "C:\xampp82\htdocs\tmpaccesspath"
  RewriteEngine on
  ServerName tmp.accesspath.com
  ServerAlias *.tmp.accesspath.com
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost tmp.accesspath.com:443>
  DocumentRoot "C:\xampp82\htdocs\tmpaccesspath"
  ServerName tmp.accesspath.com
  ServerAlias *.tmp.accesspath.com
  SSLEngine on
  SSLCertificateFile "conf/tmpaccesspath/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/tmpaccesspath/ssl.key/server.key"
</VirtualHost>
<VirtualHost accesspath.com:80>
  DocumentRoot "C:\xampp82\htdocs\accesspath"
  RewriteEngine on
  ServerName accesspath.com
  ServerAlias *.accesspath.com
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost accesspath.com:443>
  DocumentRoot "C:\xampp82\htdocs\accesspath"
  ServerName accesspath.com
  SSLEngine on
  SSLCertificateFile "conf/accesspath/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/accesspath/ssl.key/server.key"
</VirtualHost>
<VirtualHost phongkham.com:80>
  DocumentRoot "C:\xampp82\htdocs\phongkhamcom"
  RewriteEngine on
  ServerName phongkham.com
  ServerAlias *.phongkham.com
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost phongkham.com:443>
  DocumentRoot "C:\xampp82\htdocs\phongkhamcom"
  ServerName phongkham.com
  ServerAlias *.phongkham.com
  SSLEngine on
  SSLCertificateFile "conf/phongkhamcom/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/phongkhamcom/ssl.key/server.key"
</VirtualHost>
<VirtualHost phongkham.vn:80>
  DocumentRoot "C:\xampp82\htdocs\phongkhamvn"
  RewriteEngine on
  ServerName phongkham.vn
  ServerAlias *.phongkham.vn
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost phongkham.vn:443>
  DocumentRoot "C:\xampp82\htdocs\phongkhamvn"
  ServerName phongkham.vn
  ServerAlias *.phongkham.vn
  SSLEngine on
  SSLCertificateFile "conf/phongkhamvn/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/phongkhamvn/ssl.key/server.key"
</VirtualHost>
<VirtualHost phongkham.net:80>
  DocumentRoot "C:\xampp82\htdocs\phongkhamnet"
  RewriteEngine on
  ServerName phongkham.net
  ServerAlias *.phongkham.net
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost phongkham.net:443>
  DocumentRoot "C:\xampp82\htdocs\phongkhamnet"
  ServerName phongkham.net
  ServerAlias *.phongkham.net
  SSLEngine on
  SSLCertificateFile "conf/phongkhamnet/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/phongkhamnet/ssl.key/server.key"
</VirtualHost>
<VirtualHost phongkham.pro:80>
  DocumentRoot "C:\xampp82\htdocs\phongkhampro"
  RewriteEngine on
  ServerName phongkham.pro
  ServerAlias *.phongkham.pro
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost phongkham.pro:443>
  DocumentRoot "C:\xampp82\htdocs\phongkhampro"
  ServerName phongkham.pro
  ServerAlias *.phongkham.pro
  SSLEngine on
  SSLCertificateFile "conf/phongkhampro/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/phongkhampro/ssl.key/server.key"
</VirtualHost>
<VirtualHost phongkham.eu:80>
  DocumentRoot "C:\xampp82\htdocs\phongkhameu"
  RewriteEngine on
  ServerName phongkham.eu
  ServerAlias *.phongkham.eu
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost phongkham.eu:443>
  DocumentRoot "C:\xampp82\htdocs\phongkhameu"
  ServerName phongkham.eu
  ServerAlias *.phongkham.eu
  SSLEngine on
  SSLCertificateFile "conf/phongkhameu/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/phongkhameu/ssl.key/server.key"
</VirtualHost>
<VirtualHost phongkham.cn:80>
  DocumentRoot "C:\xampp82\htdocs\phongkhamcn"
  RewriteEngine on
  ServerName phongkham.cn
  ServerAlias *.phongkham.cn
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost phongkham.cn:443>
  DocumentRoot "C:\xampp82\htdocs\phongkhamcn"
  ServerName phongkham.cn
  ServerAlias *.phongkham.cn
  SSLEngine on
  SSLCertificateFile "conf/phongkhamcn/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/phongkhamcn/ssl.key/server.key"
</VirtualHost>
<VirtualHost phongkham.fr:80>
  DocumentRoot "C:\xampp82\htdocs\phongkhamfr"
  RewriteEngine on
  ServerName phongkham.fr
  ServerAlias *.phongkham.fr
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost phongkham.fr:443>
  DocumentRoot "C:\xampp82\htdocs\phongkhamfr"
  ServerName phongkham.fr
  ServerAlias *.phongkham.fr
  SSLEngine on
  SSLCertificateFile "conf/phongkhamfr/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/phongkhamfr/ssl.key/server.key"
</VirtualHost>
<VirtualHost phongkham.en:80>
  DocumentRoot "C:\xampp82\htdocs\phongkhamen"
  RewriteEngine on
  ServerName phongkham.en
  ServerAlias *.phongkham.en
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost phongkham.en:443>
  DocumentRoot "C:\xampp82\htdocs\phongkhamen"
  ServerName phongkham.en
  ServerAlias *.phongkham.en
  SSLEngine on
  SSLCertificateFile "conf/phongkhamen/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/phongkhamen/ssl.key/server.key"
</VirtualHost>
<VirtualHost phongkham.us:80>
  DocumentRoot "C:\xampp82\htdocs\phongkhamus"
  RewriteEngine on
  ServerName phongkham.us
  ServerAlias *.phongkham.us
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost phongkham.us:443>
  DocumentRoot "C:\xampp82\htdocs\phongkhamus"
  ServerName phongkham.us
  ServerAlias *.phongkham.us
  SSLEngine on
  SSLCertificateFile "conf/phongkhamus/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/phongkhamus/ssl.key/server.key"
</VirtualHost>
<VirtualHost test.com:80>
  DocumentRoot "C:\xampp82\htdocs\testcom\public"
  RewriteEngine on
  ServerName test.com
  ServerAlias *.test.com
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost test.com:443>
  DocumentRoot "C:\xampp82\htdocs\testcom\public"
  ServerName test.com
  ServerAlias *.test.com
  SSLEngine on
  SSLCertificateFile "conf/testcom/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/testcom/ssl.key/server.key"
</VirtualHost>
<VirtualHost test.vn:80>
  DocumentRoot "C:\xampp82\htdocs\testvn"
  RewriteEngine on
  ServerName test.vn
  ServerAlias *.test.vn
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost test.vn:443>
  DocumentRoot "C:\xampp82\htdocs\testvn"
  ServerName test.vn
  ServerAlias *.test.vn
  SSLEngine on
  SSLCertificateFile "conf/testvn/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/testvn/ssl.key/server.key"
</VirtualHost>
<VirtualHost test.net:80>
  DocumentRoot "C:\xampp82\htdocs\testnet"
  RewriteEngine on
  ServerName test.net
  ServerAlias *.test.net
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost test.net:443>
  DocumentRoot "C:\xampp82\htdocs\testnet"
  ServerName test.net
  ServerAlias *.test.net
  SSLEngine on
  SSLCertificateFile "conf/testnet/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/testnet/ssl.key/server.key"
</VirtualHost>
<VirtualHost test.pro:80>
  DocumentRoot "C:\xampp82\htdocs\testpro"
  RewriteEngine on
  ServerName test.pro
  ServerAlias *.test.pro
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost test.pro:443>
  DocumentRoot "C:\xampp82\htdocs\testpro"
  ServerName test.pro
  ServerAlias *.test.pro
  SSLEngine on
  SSLCertificateFile "conf/testpro/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/testpro/ssl.key/server.key"
</VirtualHost>
<VirtualHost test.eu:80>
  DocumentRoot "C:\xampp82\htdocs\testeu"
  RewriteEngine on
  ServerName test.eu
  ServerAlias *.test.eu
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost test.eu:443>
  DocumentRoot "C:\xampp82\htdocs\testeu"
  ServerName test.eu
  ServerAlias *.test.eu
  SSLEngine on
  SSLCertificateFile "conf/testeu/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/testeu/ssl.key/server.key"
</VirtualHost>
<VirtualHost test.cn:80>
  DocumentRoot "C:\xampp82\htdocs\testcn"
  RewriteEngine on
  ServerName test.cn
  ServerAlias *.test.cn
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost test.cn:443>
  DocumentRoot "C:\xampp82\htdocs\testcn"
  ServerName test.cn
  ServerAlias *.test.cn
  SSLEngine on
  SSLCertificateFile "conf/testcn/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/testcn/ssl.key/server.key"
</VirtualHost>
<VirtualHost test.fr:80>
  DocumentRoot "C:\xampp82\htdocs\testfr\public"
  RewriteEngine on
  ServerName test.fr
  ServerAlias *.test.fr
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost test.fr:443>
  DocumentRoot "C:\xampp82\htdocs\testfr\public"
  ServerName test.fr
  ServerAlias *.test.fr
  SSLEngine on
  SSLCertificateFile "conf/testfr/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/testfr/ssl.key/server.key"
</VirtualHost>
<VirtualHost test.en:80>
  DocumentRoot "C:\xampp82\htdocs\testen\public"
  RewriteEngine on
  ServerName test.en
  ServerAlias *.test.en
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost test.en:443>
  DocumentRoot "C:\xampp82\htdocs\testen\public"
  ServerName test.en
  ServerAlias *.test.en
  SSLEngine on
  SSLCertificateFile "conf/testen/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/testen/ssl.key/server.key"
</VirtualHost>
<VirtualHost test.us:80>
  DocumentRoot "C:\xampp82\htdocs\testus\public"
  RewriteEngine on
  ServerName test.us
  ServerAlias *.test.us
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</VirtualHost>
<VirtualHost test.us:443>
  DocumentRoot "C:\xampp82\htdocs\testus\public"
  ServerName test.us
  ServerAlias *.test.us
  SSLEngine on
  SSLCertificateFile "conf/testus/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/testus/ssl.key/server.key"
</VirtualHost>
<VirtualHost test1.com:443>
  DocumentRoot "C:\xampp82\htdocs\test1"
  ServerName test1.com
  ServerAlias *.test1.com
  SSLEngine on
  SSLCertificateFile "conf/test1/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/test1/ssl.key/server.key"
</VirtualHost>
<VirtualHost test2.com:443>
  DocumentRoot "C:\xampp82\htdocs\test2"
  ServerName test2.com
  ServerAlias *.test2.com
  SSLEngine on
  SSLCertificateFile "conf/test2/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/test2/ssl.key/server.key"
</VirtualHost>
<VirtualHost test3.com:443>
  DocumentRoot "C:\xampp82\htdocs\test3"
  ServerName test3.com
  ServerAlias *.test3.com
  SSLEngine on
  SSLCertificateFile "conf/test3/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/test3/ssl.key/server.key"
</VirtualHost>
<VirtualHost test4.com:443>
  DocumentRoot "C:\xampp82\htdocs\test4"
  ServerName test4.com
  ServerAlias *.test4.com
  SSLEngine on
  SSLCertificateFile "conf/test4/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/test4/ssl.key/server.key"
</VirtualHost>
<VirtualHost test5.com:443>
  DocumentRoot "C:\xampp82\htdocs\test5"
  ServerName test5.com
  ServerAlias *.test5.com
  SSLEngine on
  SSLCertificateFile "conf/test5/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/test5/ssl.key/server.key"
</VirtualHost>
<VirtualHost test6.com:443>
  DocumentRoot "C:\xampp82\htdocs\test6"
  ServerName test6.com
  ServerAlias *.test6.com
  SSLEngine on
  SSLCertificateFile "conf/test6/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/test6/ssl.key/server.key"
</VirtualHost>
<VirtualHost test7.com:443>
  DocumentRoot "C:\xampp82\htdocs\test7"
  ServerName test7.com
  ServerAlias *.test7.com
  SSLEngine on
  SSLCertificateFile "conf/test7/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/test7/ssl.key/server.key"
</VirtualHost>
<VirtualHost test8.com:443>
  DocumentRoot "C:\xampp82\htdocs\test8"
  ServerName test8.com
  ServerAlias *.test8.com
  SSLEngine on
  SSLCertificateFile "conf/test8/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/test8/ssl.key/server.key"
</VirtualHost>
<VirtualHost nextbrand.com.vn:443>
  DocumentRoot "C:\xampp82\htdocs\nextbrand"
  ServerName nextbrand.com.vn
  ServerAlias *.nextbrand.com.vn
  SSLEngine on
  SSLCertificateFile "conf/nextbrand/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/nextbrand/ssl.key/server.key"
</VirtualHost>
<VirtualHost scholarsprep.net:443>
  DocumentRoot "C:\xampp82\htdocs\scholarsprep"
  ServerName scholarsprep.net
  ServerAlias *.scholarsprep.net
  SSLEngine on
  SSLCertificateFile "conf/scholarsprep/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/scholarsprep/ssl.key/server.key"
</VirtualHost>

Chú ý: Để nó chuyển từ http đến htttps ta có :)

C:\xampp\htdocs\blog\public.htaccess

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTPS} !=on   
	RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>

Full remove index.php public && http to https

C:\xampp\htdocs\blog\public.htaccess

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteRule ^(.*)$ index.php/$1 [L]
  RewriteCond %{HTTPS} !=on   
	RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>

Đã thực hiện thành công theo videos :)))

https://drive.google.com/file/d/1ulLGJv-HVN0ucCltCO8mX_jrBA7dANl5/view?usp=sharing

2 files cần chỉnh sửa th eo dạng này :)

CMD RUN: certmgr.msc

C:\xampp\apache\https.ext

authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = auth.com
DNS.2 = localhost

C:\xampp\apache\conf\extra\httpd-xampp.conf

 ## auth.com
 <VirtualHost auth.com:443>
     DocumentRoot "C:\xampp\htdocs\auth\public"
     ServerName auth.com
     ServerAlias *.auth.com
     SSLEngine on
     SSLCertificateFile "conf/ssl.crt/server.crt"
     SSLCertificateKeyFile "conf/ssl.key/server.key"
 </VirtualHost>

Kết quả:

Mẹo hướng dẫn cấu hình SSL trên localhost cho XAMPP

Bài viết này sẽ hướng dẫn cách bạn tạo chứng chỉ SSL cục bộ được sử dụng trong XAMPP trên Windows.

Trong bài viết này sẽ sử dụng tên miền ảo làm ví dụ là site.test

1. VÀO THƯ MỤC APACHE TRONG XAMPP.

Mặc định XAMPP đợc cài đặt trong thư mục C:\xampp\apache.

2. TẠO MỘT THƯ MỤC MỚI.

Đây là nơi ta sẽ lưu trữ chứng chỉ SSL. Trong ví dụ này Ngôi Sao Số sẽ tạo thư mục crt ,Vì vậy, đường dẫn sẽ có dạng C:\xampp\apache\crt

3. TẢI VỀ VÀ THÊM 2 TẬP TIN NÀY VÀO THƯ MỤC VỪA TẠO

Vào đường dẫn sau tải 2 tập tin cert.conf make-cert.bat về. 2 tập tin này sẽ dùng để tạo chứng chỉ SSL cho tên miền tùy thích.

4. SỬA CERT.CONF VÀ CHẠY MAKE-CERT.BAT

Mở file cert.conf và thay đổi {{DOMAIN}} thành tên miền bạn muốn, trong trường hợp này site.test và lưu lại.

Nhấp đúp chuột vào make-cert.bat và nhập tên miền site.test khi được nhắc. Và nhập trả lời cho các câu hỏi khác, thiết lập mặc định có sẵn trong cert.conf

5. CÀI ĐẶT CHỨNG CHỈ TRONG WINDOWS.

Sau đó, bạn sẽ thấy thư mục site.test được tạo. Trong thư mục đó ta sẽ có server.crt and server.key. Đây là chứng chỉ SSL certificate.

Chọn NextFinish.

Và bây giờ chứng chỉ này đã được cài đặt là tin cậy (trusted) trong Windows. Tiếp theo là làm thế nào để sử dụng chứng chỉ này trong XAMPP.

6. THÊM TRANG WEB TRONG MÁY CHỦ WINDOWS

  1. Mở notepad với quyền administrator.

  2. Sửa C:\Windows\System32\drivers\etc\hosts

  3. Thêm một dòng mới:

127.0.0.1 site.test

Điều này sẽ giúp XAMPP khi truy cập http://site.test sẽ trỏ tên miền này về IP localhost

7. THÊM TÊN MIỀN NÀY VÀO FILE CONF CỦA XAMPP.

Giờ bạn cần kích hoạt SSL cho tên miền này và cho XAMPP biết nơi lưu trữ Chứng chỉ SSL. Vì vậy, bạn cần chỉnh sửa C:\xampp\apache\conf\extra\httpd-xampp.conf

Và thêm dòng mới này dưới cùng:

## site.test
 <VirtualHost *:80>
     DocumentRoot "C:/xampp/htdocs"
     ServerName site.test
     ServerAlias *.site.test
 </VirtualHost>
 <VirtualHost *:443>
     DocumentRoot "C:/xampp/htdocs"
     ServerName site.test
     ServerAlias *.site.test
     SSLEngine on
     SSLCertificateFile "crt/site.test/server.crt"
     SSLCertificateKeyFile "crt/site.test/server.key"
 </VirtualHost>

Sau đó, bạn sẽ cần khởi động lại Apache trong XAMPP. Đơn giản, chỉ cần mở Bảng điều khiển XAMPP và bấm stop và start tại mục Apache. Mẹo: Trong file conf XAMPP, bạn có thể thay đổi thư mục gốc cho từng tên miền nếu cần.

8. KHỞI ĐỘNG LẠI TRÌNH DUYỆT VÀ THỬ LẠI!

Cần khởi động lại trình duyệt để hệ thống tải chứng chỉ. Và truy cập tên miền trên trình duyệt của bạn, và bạn sẽ thấy khóa màu xanh lá như hình bên dưới!

Ngôi Sao Số hy vọng hướng dẫn này hữu ích!

9. Setting a Local Development Environment for Laravel on Windows | Install Laravel on Windows

Setting a Local Development Environment for Laravel on Windows | Install Laravel on Windows

Many developers use Windows for PHP projects, we will cover a basic XAMPP Setup for a Laravel project. Following these easy steps will help you run your PHP projects and install Laravel on Windows in a matter of minutes.

Installing XAMPP for Laravel

  1. Download XAMPP for Windows from their official site: https://www.apachefriends.org/download.html

  2. For our example, we’ve chosen PHP 7.1 and XAMPP 32 bit

  3. Run the installer and select Apache, MySQL and phpMyAdmin

  4. It’s recommended to make the installation in C:\ to avoid issues with Windows User permissions (or the drive where your Windows is installed)

  5. After it’s complete do not start anything just yet.

Setting PHP from Windows CMD

  1. Open Advanced System Settings (System Properties -> Advanced)

  2. Open Environment Variables

  3. On the top window select Path and click on Edit

  4. In the new window click on New

  5. We need to enter the path to XAMPP’s PHP

    C:\xampp\php
  6. We will also add MySQL’s Path, click on New again and enter

    C:\xampp\mysql\bin

Composer from Windows CMD

  1. Download Composer’s Windows .exe installer: https://getcomposer.org/download/

  2. Place the installer and run it from the added to Path directory – C:\xampp\php

Now that we have Apache, PHP, MySQL and Composer installed, we’re ready to install Laravel, set a Virtual Host with a custom domain for local development. XAMPP’s Apache uses the htdocs folder for serving HTTP requests, we’ll set our custom Laravel Virtual Host under C:\xampp\htdocs\example\ which will be opened locally from example.com

Install Laravel on Windows with Composer

  1. Open Window’s CMD or PowerShell

    cd C:\xampp\htdocs
  2. Install Laravel using Composer

    composer create-project --prefer-dist laravel/laravel example

Creating MySQL Database for Laravel

  1. Open the CMD or PowerShell again

  2. Access the MySQL CLI

    mysql -u root -p
  3. Create Database for Laravel

    CREATE DATABASE laravel DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

Setting Laravel’s .env file

  1. Navigate to C:\xampp\htdocs\example

  2. Open the config/database.php file and edit the MySQL Connection settings

    'mysql' => [
        'read' => [
            'host' => [
                '192.168.1.1',
                '196.168.1.2',
            ],
        ],
        'write' => [
            'host' => [
                '196.168.1.3',
             ],
        ],
        'sticky'    => true,
        'driver'    => 'mysql',
        'database'  => 'laravel',
        'username'  => 'root',
        'password'  => 'THE ONE YOU CREATED THE USER WITH',
        'charset'   => 'utf8mb4',
        'collation' => 'utf8mb4_unicode_ci',
        'prefix'    => '',
    ],

Virtual Host with XAMPP

  1. Navigate to C:\xampp\apache\conf\extra

  2. Open httpd-vhosts.conf and append:

    NameVirtualHost *:80
    <VirtualHost example.com:80>
        DocumentRoot "C:\xampp\htdocs\example\public"
        ServerName example.com
        ServerAlias www.example.com
        
        <Directory "c:/xampp/htdocs/example/public">
            Require all granted
        </Directory>
    </VirtualHost>

Enable mod_rewrite for Laravel

  1. Open the httpd.conf file in C:\xampp\apache\conf\extra

  2. Look for LoadModule rewrite_module modules/mod_rewrite.so and remove the ; at the start

Setting local domain with hosts file

  1. Navigate to c:\Windows\System32\Drivers\etc

  2. Open the hosts file with Administrator Privileges

  3. Append the line at the bottom

    127.0.0.1 www.example.com example.com

Start Apache and MySQL, your local Laravel project will be opened from example.com and you’re ready to start working on it. When ready you can contact us to have it deployed on a WebHostFace server

You can benefit from a fast and reliable SSD Laravel Hosting with our shared hosting services. Now with a greatly discounted price! Start your new Laravel project on a professionally set hosting environment without investing a large amount of money and grow your online presence!

Last updated