เนื่องจากโลกเราเริ่มร้ายขึ้น http
ก็เริ่มจะถูกกาเป็น insecure origin ซะงั้น
ก็เลยต้องมาเริ่มกับการจัดการ SSL กันว่า ต้องทำไง อย่างแรกก็ไปหา certificate มาก่อน มีทั้งฟรี และไม่ฟรี ถูกถึงแพง
- ฟรีงานเยอะ limit ก็เหมือนๆของถูก
- ถูกก็งานน้อย limit อยู่ที่ subdomain เดียว $10+/yr
- แพงๆ ก็พวก wildcard มี subdomain ได้ไม่อั้น $100+/yr
พอได้มา จะมาจัดการใน nginx ที่แตกต่างกับเดิมจริงๆ ก็แค่ ส่วนนี้
listen 443 ssl;
server_name whatever.your-domain.com;
ssl_certificate /path-to-your.crt;
ssl_certificate_key /path-to-your.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# Disables all weak ciphers
ssl_ciphers ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM;
ส่วนอันนี้ เก็บไว้เผื่ออ้างอิงสำหรับ protocol อื่นๆ ที่ไม่ได้เปิดใช้
# Disable all protocol with problems
# [2014-10-20] don’t use SSLv3 ref: POODLE
# ssl_protocols SSLv3 TLSv1; #enables SSLv3/TLSv1, but not SSLv2 which is weak and should no longer be used.
Remove the key pass phrase:
ในกรณีที่ดันไปสร้าง key pass ไว้ เวลา restart webserver ทุกครั้งมันจะถาม น่ารำคาญเกิ้น~
openssl rsa -in key.pem -out newkey.pem
If they certificate and key are together:
openssl rsa -in mycert.pem -out newcert.pem
openssl x509 -in mycert.pem >>newcert.pem