1、生成https证书,测试使用,正式使用需要购买生成私钥文件 sudo openssl genrsa -aes256 -out service.key 1024然后按提示输入密码,文件生成成功
2、生成证书文件并签署sudo openssl req -sha25瀵鸦铙邮6 -new -x509 -days 1826 -key service.key -out service.crt估计提示输入相关信息Common Name (e.g. server FQDN or YOUR name) []:这一项必须和你的域名一致
3、配置apache,开启https打开httpd.conf文件:移除注释LoadModule ssl_module libexec/apache2/mod_ssl.soInclude /private/etc/apache2/extra/httpd-vhosts.conf
4、修改httpd-vhosts.罕铞泱殳conf文件修改DocumentRoot "/Users/xun锾攒揉敫ao/website/upload" 为自己的网站路径指定证书和密钥文件路径SSLCertificateFile "/private/etc/apache2/server.crt"SSLCertificateKeyFile "/private/etc/apache2/server.key"
5、重启apache用 sudo apachectl configtest 检测配置文件是否有错误(windows为httpd -t)sudo apachectl restart (windows为httpd -k restart)
6、访问网站:https://域名如果浏览器提示“您的连接不是私密连接”,则需安装证书的本地计算机