项目需要获取到客户端的证书信息,https都配置走通了,只有证书和key才能登陆网站,但是想要做到,相应的证书只能其相应的账号登陆,这就只有在有自己的key而且知道相应的账号密码才能登陆。
之前也没做过这一块,所以查了很多案例,但是php的案例几乎没有找到,最后找大神的文章:https://cweiske.de/tagebuch/ssl-client-certificates.htm
下面说一下如何实现的。
首先SSL服务器,https等都要配置好,这里就不做详细叙述了,文章有很多。
SSL基础的virtual host配置是这样的
<span style="font-size:12px;"><VirtualHost *:443>
ServerName bookmarks.cweiske.de
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog /var/log/apache2/access_log vcommon
VirtualDocumentRoot /home/cweiske/Dev/html/hosts/bookmarks.cweiske.de
<Directory "/home/cweiske/Dev/html/hosts/bookmarks.cweiske.de">
AllowOverride all
</Directory>