Step1)更新系統套件
#pkg update
#pkg upgrade
Step2)安裝apache24
#pkg install apache24
Step3)編輯/etc/rc.conf
apache24_enable="YES"
Step4)編輯/usr/local/etc/apache24/httpd.conf
Line226:ServerName 192.168.xx.xx:80
啟動apache24
#service apache24 start
Step5)使用openssl建立憑證
#mkdir /etc/ssl/private/
#openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/selfsigned.key -out /etc/ssl/certs/selfsigned.crt
輸入一些資料
Country Name (2 letter code) [AU]:TW
State or Province Name (full name) [Some-State]:TW
Locality Name (eg, city) []:Taipei
Organization Name (eg, company) [Internet Widgits Pty Ltd]:test
Organizational Unit Name (eg, section) []:test
Common Name (e.g. server FQDN or YOUR name) []:test.ooo.xxx
Email Address []:輸入enter即可
Step6)編輯/usr/loca/etc/apache24/httpd.conf
Line92:LoadModule socache_shmcb_module libexec/apache24/mod_socache_shmcb.so
Line148:LoadModule ssl_module libexec/apache24/mod_ssl.so
Line226:ServerName 192.168.xx.xx:80
Line526:Include etc/apache24/extra/httpd-ssl.conf
Step7)編輯/usr/local/etc/apache24/extra/httpd-ssl.conf
Line144:SSLCertificateFile "/etc/ssl/certs/selfsigned.crt"
Line154:SSLCertificateKeyFile "/etc/ssl/private/selfsigned.key"
Step8)測試httpd.conf設定
apachectl -t
Step9)重新啟動apache24
service apache24 restart
Step10)使用瀏覽器瀏覽https://192.168.xx.xx
參考:Install Apache with Self-signed Certificate on FreeBSD 12