首页 > 代码库 > lamp----6 实现虚拟主机ssl安全

lamp----6 实现虚拟主机ssl安全

yum install mod_ssl.x86_64   #安装加密组件

cd /etc/pki/tls/certs/    #必须在此目录下make

make han.pem

chmod +x han.pem

vi /etc/httpd/conf.d/ssl.conf

SSLCertificateFile /etc/pki/tls/certs/han.pem

SSLCertificateKeyFile /etc/pki/tls/certs/han.pem

技术分享

 

vi /etc/httpd/conf/httpd.conf

SSLStrictSNIVHostCheck on
NameVirtualHost *:80
NameVirtualHost *:443

<VirtualHost *:443>
ServerName www.han.com
DocumentRoot /web/upload
SSLEngine on
SSLCertificateFile "/etc/pki/tls/certs/han.pem"
SSLCertificateKeyFile "/etc/pki/tls/certs/han.pem"
<Directory "/web/upload">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>

ErrorLog /var/log/httpd/142error.log
CustomLog /var/log/httpd/142access.log combined
</VirtualHost>

<VirtualHost 192.168.1.142:80>
ServerName www.lei.com
DocumentRoot /var/www/html/upload

<Directory "/var/www/html/upload">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>

ErrorLog /var/log/httpd/143error.log
CustomLog /var/log/httpd/143access.log combined
</VirtualHost>

技术分享

 

systemctl restart httpd.service

访问 https://www.han.com/    测试

技术分享

 

lamp----6 实现虚拟主机ssl安全