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

Posted 奥特最帅

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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安全的主要内容,如果未能解决你的问题,请参考以下文章

nginx做安全的虚拟主机

Apache虚拟主机绑定域名证书和ssl_module模块

使用 SSL 的 Apache 名称虚拟主机

新网虚拟怎么开启SSL配置

使用 VirtualDocumentRoot 在 SSL 中进行虚拟主机

apache实现多域名虚拟主机的SSL认证