การทำให้ xampp บริการ ssl

ขั้นตอนการทำให้ xampp บริการ ssl ใน localhost
ซึ่งใช้งานได้จริงกับใน localhost เท่านั้น

1. https://ssl.indexnl.com/
2. กรอก localhost ในช่อง domain
3. download 51398a-localhost.zip
แฟ้มนี้ใครก็ใช้ได้ครับ ถ้ามี domain คือ localhost
https://drive.google.com/open?id=1St..IHKE3
คลาย zip พบ 4 แฟ้ม
– ca.ssl.indexnl.com.crt
– localhost.crt
– localhost.key
– readme.txt
4. ใน readme.txt แนะนำว่า
– มีวิธีติดตั้งที่ https://ssl.indexnl.com/xampp-wamp-ssl/
– มี certificate อายุ 3 เดือนที่ https://wildcard.indexnl.com/
– มี community พูดคุยกันที่ https://community.apachefriends.org/f/
5. คัดลอก 2 แฟ้ม
– localhost.key ไปไว้ใน c:\xampp\apache\conf\ssl.key\
– localhost.crt ไปไว้ใน C:\xampp\apache\conf\ssl.crt\
6. ค้น certmgr พบ manage computer certificates
คลิ๊กเลือก Trusted Root Certification Authorities
ที่บน menu bar คลิ๊ก Action, All tasks, import, next, browse
เลือกแฟ้ม ca.ssl.indexnl.com.crt แล้ว open, next, finish
พบ The import was successful.
7. เข้าห้อง c:\xampp\apache\conf\extra\
แล้วเปิดแฟ้ม httpd-vhosts.conf ด้วย editor
8. เพิ่มบรรทัดต่อไปนี้ ต่อท้ายสุดของแฟ้ม

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot “c:\xampp\htdocs”
ServerName localhost
ServerAlias localhost
ErrorLog “logs/localhost-error.log”
CustomLog “logs/localhost-access.log” common
</VirtualHost>

9. ในแฟ้มเดิม ลบโค้ดเดิม และเพิ่มโค้ดใหม่
ข้างล่างนี้เป็นของใหม่

<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot “c:\xampp\htdocs”
ServerName localhost
ServerAlias localhost
SSLEngine on
SSLCertificateFile “c:\xampp\apache\conf\ssl.crt\localhost.crt”
SSLCertificateKeyFile “c:\xampp\apache\conf\ssl.key\localhost.key”
<FilesMatch “\.(cgi|shtml|phtml|php)$”>
SSLOptions +StdEnvVars
</FilesMatch>
ErrorLog “logs/localhost-error.log”
CustomLog “logs/localhost-access.log” common
</VirtualHost>

10. restart xampp
แล้วเปิด https://localhost

อ่านเพิ่มที่ http://www.thaiall.com/omni/indexo.html

Author: บุรินทร์ รุจจนพันธุ์

I am Lecturer, Developer, Researcher, Columnist, Writer, Photographer, and Webmaster - L@mpang man

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.