一个服务器上绑定多个域名,我用的是阿里的服务器,windows系统,一开始在阿里云买了两个域名,都绑定在同一个公网IP地址,这样两个域名访问的是同一个目录.
然后需要编辑\Apache24\conf\httpd.conf文件。
找到这句:“#Include etc/extra/httpd-vhosts.conf”,去掉#号,开启虚拟主机功能.
接下来extra/httpd-vhosts.conf中进行虚拟主机的配置操作.
<Directory "C:/www">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
<VirtualHost *:443>
DocumentRoot "F:/www/sixpoint"
ServerName www.kj.com:443
SSLEngine On
SSLProtocol TLSv1 TLSv1.1 TLSv1.2
SSLCertificateFile "F:/Apache24/cert/public.pem"
SSLCertificateKeyFile "F:/Apache24/cert/21408086936511.key"
SSLCertificateChainFile "F:/Apache24/cert/chain.pem"
SSLCipherSuite ECDHE-RSA-AES128-G31-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "F:/www/sixpoint"
ServerName www.kj.com:80
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "F:/www/comp"
ServerName www.qinzhou.com
</VirtualHost>
SSL是配置https协议的,协议都来自阿里云
这样基本就配置好了虚拟主机