Web FullStack Thương Mại Điện Tử | NenTang.vn |
Chương 2-Bài 9. Tạo chứng chỉ SSL trên Localhost |
||
Tác giả: Dương Nguyễn Phú Cường | Ngày đăng: Hồi xưa đó | Lượt xem: 375 |
1. Navigate to Apache directory in XAMPP.In regular install it’s in C:\xampp\apache.2. Create a folder in that page.This is where we will store our cert. In this example I will create “crt” folder. So we will have C:\xampp\apache\crt3. Add this files.4. Edit cert.conf and Run make-cert.batChange {{DOMAIN}} text using the domain we want to use, in this case site.test and save. Double click the make-cert.bat and input the domain site.test when prompted. And just do enter in other question since we already set the default from cert.conf.
Note: I don’t know how to do text replace in .bat script, if you do, let me know in the comment how to do it and I will update make-cert.bat to automatically replace the {{DOMAIN}} with the domain input.
5. Install the cert in windows.After that, you will see site.test folder created. In that folder we will have server.crt and server.key. This is our SSL certificate. Double click on the server.crt to install it on Windows so Windows can trust it.6. Add the site in Windows hosts
7. Add the site in XAMPP conf.We need to enable SSL for this domain and let XAMPP know where we store the SSL Cert. So we need to edit C:\xampp\apache\conf\extra\httpd-xampp.conf And add this code at the bottom:
Tips: In XAMPP conf, as you can see you can change the domain root directory if needed. Eg. as sub-dir in htdocs.
8. Restart your browser and Done!This is required to load the certificate. And visit the domain on your browser, and you will see green lock! |
Sản phẩm của Nền tảng | NenTang.vn - Hành trang tới Tương lai |