upupw 多站点配置SSL

发布时间:2018/6/26 21:42:36 打印 字号:

Apache配置SSL证书: 
1.修改目录/Apache2/conf/下的httpd.conf 

将#LoadModule socache_shmcb_module modules/mod_socache_shmcb.so 

去掉注释:loadModule socache_shmcb_module modules/mod_socache_shmcb.so 


将#LoadModule ssl_module modules/mod_ssl.so 

去掉注释:LoadModule ssl_module modules/mod_ssl.so 


将#Include conf/extra/httpd-ssl.conf 

去掉注释:Include conf/extra/httpd-ssl.conf 


保存并退出httpd.conf。 


复制以下代码 

<virtualhost _default_:443=""> 
    DocumentRoot "C:/web/UPUPW_AP7.0/vhosts/www.abc.com" 
    ServerName www.abc.com:443 
    ServerAlias www.abc.com 
    ServerAdmin webmaster@example.com 
    DirectoryIndex index.html index.htm index.php default.php app.php u.php 
    ErrorLog logs/example_error.log 
    CustomLog logs/example_access.log \ 
    "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" 
    SSLEngine on 
    SSLCertificateFile "C:/web/UPUPW_AP7.0/Apache2/conf/2_www.abc.com.crt" 
    SSLCertificateKeyFile "C:/web/UPUPW_AP7.0/Apache2/conf/3_www.abc.key" 
    SSLCertificateChainFile "C:/web/UPUPW_AP7.0/Apache2/conf/1_root_bundle.crt" 
<Directory "C:/web/UPUPW_AP7.0/vhosts/www.abc.com"> 
    SSLOptions +StdEnvVars 
    AllowOverride All 
    Require all granted 
</directory> 
<FilesMatch "\.(shtml|phtml|php)$"> 
    SSLOptions +StdEnvVars 
</filesmatch> 
    BrowserMatch "MSIE [2-5]" \ 
    nokeepalive ssl-unclean-shutdown \ 
    downgrade-1.0 force-response-1.0 
</virtualhost>



修改conf目录下的httpd-vhosts.conf文件: 
添加刚才复制的内容 

将DocumentRoot "C:/web/UPUPW_AP7.0/vhosts/www.abc.com"中的sslroot/路径改为你网站根目录的绝对路径:如C:/UPUPW_AP7.0/vhosts/www.abc.com (注意路径反斜杠方向) 

同时修改证书内容,密钥的路径,SSLCertificateFile "C:/web/UPUPW_AP7.0/Apache2/conf/2_
www.abc.com.crt"中的2_www.abc.com.crt改为你证书的绝对路径 

SSLCertificateKeyFile "C:/web/UPUPW_AP7.0/Apache2/conf/3_
www.abc.key"中的C:/web/UPUPW_AP7.0/Apache2/conf/3_www.abc.key改为你证书密钥的绝对路径。如果有证书链,则在下一行 

加上SSLCertificateChainFile "C:/web/UPUPW_AP7.0/Apache2/conf/1_root_bundle.crt",记得修改证书链的路径。 

如: 
SSLCertificateFile ""C:/UPUPW_AP7.0/Apache2/conf/server.crt" 
SSLCertificateKeyFile ""C:/UPUPW_AP7.0/Apache2/conf/server.key" 
SSLCertificateChainFile "C:/UPUPW_AP7.0/Apache2/conf/chain.crt" 

上面只是示例,按照你证书的路径修改。 

保存并退出httpd-vhosts.conf。 

3.回到主面板,输入rr回车以重启Apache。 


注:需要多个站点使用SSL就重复以上步骤,不要搞乱就行!