配置https虚拟主机
配置httpd.conf,取消以下注释
LoadModule ssl_module modules/mod_ssl.so
Include /etc/httpd24/extra/httpd-ssl.conf
[root@liu conf]# vim httpd.conf
...
LoadModule ssl_module modules/mod_ssl.so
#LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
...
# Secure (SSL/TLS) connections
Include conf/extra/httpd-ssl.conf
...
在httpd-ssl.conf中配置证书的位置
[root@liu extra]# ls
httpd-autoindex.conf httpd-languages.conf httpd-ssl.conf
httpd-dav.conf httpd-manual.conf httpd-userdir.conf
httpd-default.conf httpd-mpm.conf httpd-vhosts.conf
httpd-info.conf httpd-multilang-errordoc.conf proxy-html.conf
[root@liu extra]# vim httpd-ssl.conf
...
DocumentRoot "/usr/local/apache/htdocs/www.liu.com"
ServerName www.liu.com:443
ServerAdmin [email protected]
ErrorLog "/usr/local/apache/logs/www.liu_error_log"
TransferLog "/usr/local/apache/logs/www.liu_access_log"
...
SSLCertificateFile "/usr/local/apache/conf/ssl/httpd.crt"
...
# Server Private Key:
# If the key is not combined with the certificate, use this
# directive to point at the key file. Keep in mind that if
# you've both a RSA and a DSA private key you can configure
# both in parallel (to also allow the use of DSA ciphers, etc.)
# ECC keys, when in use, can also be configured in parallel
SSLCertificateKeyFile "/usr/local/apache/conf/ssl/httpd.key"
取消shmcb.这行的注释
[root@liu ~]# cd /usr/local/apache/conf
[root@liu conf]# vim httpd.conf
...
#找到shmcb这行取消注释
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so #取消此行注释
#语法检验
[root@liu ~]# httpd -t
Syntax OK
启动重启服务测试
[root@liu ~]# systemctl start httpd
[root@liu ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 0.0.0.0:58247 0.0.0.0:*
LISTEN 0 128 0.0.0.0:111 0.0.0.0:*
LISTEN 0 128 0.0.0.0:20048 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 [::]:43549 [::]:*
LISTEN 0 128 *:8080 *:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 [::]:111 [::]:*
LISTEN 0 128 [::]:20048 [::]:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 128 *:443 *:*
标签:httpd,https,虚拟主机,ssl,0.0,配置,liu,conf,128
From: https://www.cnblogs.com/lqy0917/p/17007138.html