实现
xxx.domain.com
yyy.domain.com
分别对应
/var/www/html/xxx
/var/www/html/xxx

配置如下
/etc/apache2/sites-available/default-ssl.conf

<IfModule mod_ssl.c>
    <VirtualHost _default_:443>
            #文档路径
            DocumentRoot /var/www/html
            #域名地址重写匹配
            RewriteEngine On
            RewriteCond %{HTTP_HOST} ^(([-_a-zA-Z0-9])+)\.\w+\.\w+$ [NC]
            RewriteRule ^(.*)$ /%1/$1 [L]
            # 错误页面提示
            ErrorDocument 404 "404 Not Found!!!"

            #日志
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
            # SSL 证书配置
            SSLEngine on
            SSLCertificateFile      /etc/apache2/ssl/fullchain.crt
            SSLCertificateKeyFile /etc/apache2/ssl/private.pem

            <FilesMatch "\.(cgi|shtml|phtml|php)$">
                            SSLOptions +StdEnvVars
            </FilesMatch>
            <Directory /usr/lib/cgi-bin>
                            SSLOptions +StdEnvVars
            </Directory>
    </VirtualHost>

标签: none

添加新评论



NULL