phpStudy安装ssl证书
2021/12/10 11:17:54
本文主要是介绍phpStudy安装ssl证书,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
phpStudy安装ssl证书 – HTTPS SSL 教程(ssl证书申请)
一、修改apache目录下的 httpd.conf 配置文件
1、#LoadModule ssl_module modules/mod_ssl.so 删除行首的配置语句注释符号“#”
2、增加一条引用语句 Include conf/vhostsssl.conf
二、
1、在conf文件夹中创建一个vhostsssl.conf配置文件。
2、编辑 vhostsssl.conf 文件,增加如下内容:
Listen 443
<VirtualHost
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
SSLCertificateFile "D:\phpStudy\SSL\2_trustauth.cn.crt"
SSLCertificateKeyFile "D:\phpStudy\SSL\trustauth.cn.key"
SSLCertificateChainFile "D:\phpStudy\SSL\1_root_bundle.crt"
DocumentRoot "c:\WWW\jsdxnb"
<Directory />
Options +Indexes +FollowSymLinks +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
其中
SSLCertificateFile 是指证书公钥
SSLCertificateKeyFile 是指证书私钥
SSLCertificateChainFile 是指根证书
三、phpstudy 配置指定路径访问 https(我这一步没有配置,不行的话可以在 .htaccess 文件中配置)。
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
</IfModule>
四、保存退出,并重启Apache。
ps:
Apache 启动不了,一般是配置文件不对,请大家耐心排查。一般启动不了是因为之前配置过SSL或者文件配置错误!
一般目录:phpStudy安装软件安装目录,C:\phpStudy\Apache\conf
以下是备用代码,这个也可以用。
Listen 443
<VirtualHost
SSLEngine On
SSLCertificateFile “D:/ssl/2_”
SSLCertificateKeyFile “D:/ssl/3_”
SSLCertificateChainFile “D:/ssl/1_root_”
#……
DocumentRoot “D:/APP”
ServerName xs.xingshili.vip:443
</VirtualHost>
这篇关于phpStudy安装ssl证书的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-03-29env: php: no such file or directory
- 2024-03-01php foreach break
- 2024-02-26Exception参数 php-icode9专业技术文章分享
- 2023-12-30PHP文件批量上传-icode9专业技术文章分享
- 2023-12-30thinkphp6 withJoin-icode9专业技术文章分享
- 2023-12-27MagicArray:像php一样,让Go业务代码不再卷!
- 2023-11-18centos7编译安装PHP教程。
- 2023-11-18centos7编译安装phpMyAdmin教程。
- 2023-10-13唱衰这么多年,PHP 仍然还是你大爷!
- 2023-07-25PHP8,性能更好,语法更好,类型安全更完善