apche服务器配置https

apche配置ssl连接,首先请您注意是否开启ssl模块,开启之后,直接写上如下配置:

  • 配置ssl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Listen 443

SSLHonorCipherOrder on

SSLPassPhraseDialog builtin

SSLSessionCache "shmcb:/usr/local/apache/logs/ssl_scache(512000)"
SSLSessionCacheTimeout 300

<VirtualHost *:443>
DocumentRoot "/home/wwwroot/vitendcom"
ServerName www.vitend.com
ServerAlias vitend.com
ErrorLog "/home/logs/error_vitendcom.log"
CustomLog "/home/logs/access_vitendcom.log" common
<Directory "/home/wwwroot/vitendcom">
Options -Indexes +FollowSymlinks
AllowOverride All
Require all granted
DirectoryIndex index.html index.php
</Directory>
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
SSLCertificateFile "conf/server.pem"
SSLCertificateKeyFile "conf/server.key"
SSLCertificateChainFile "conf/ca.pem"
</VirtualHost>



<VirtualHost *:443>
DocumentRoot "/home/wwwroot/wxvitendcom"
ServerName wx.vitend.com
ErrorLog "/home/logs/error_wxvitendcom.log"
CustomLog "/home/logs/access_wxvitendcom.log" common
<Directory "/home/wwwroot/wxvitendcom">
Options -Indexes +FollowSymlinks
AllowOverride All
Require all granted
DirectoryIndex index.html index.php
</Directory>
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
SSLCertificateFile "conf/server.pem"
SSLCertificateKeyFile "conf/server.key"
SSLCertificateChainFile "conf/ca.pem"
</VirtualHost>
<VirtualHost *:443>
DocumentRoot "/home/wwwroot/snsvitendcom"
ServerName sns.vitend.com
ErrorLog "/home/logs/error_vitendcom.log"
CustomLog "/home/logs/access_vitendcom.log" common
<Directory "/home/wwwroot/snsvitendcom">
Options -Indexes +FollowSymlinks
AllowOverride All
Require all granted
DirectoryIndex index.html index.php
</Directory>
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
SSLCertificateFile "conf/server.pem"
SSLCertificateKeyFile "conf/server.key"
SSLCertificateChainFile "conf/ca.pem"
</VirtualHost>
  • 配置301跳转
    1
    2
    3
    4
    <VirtualHost *:80> 
    ServerName sns.vitend.com
    RedirectMatch permanent ^/(.*) https://sns.vitend.com/$1
    </VirtualHost>
感谢老板!