让我们加密" new"域

时间:2018-03-10 12:01:31

标签: debian certificate apache2 subdomain lets-encrypt

我过去常常通过名为 domain.com 的方形空间来托管我的网站。

我决定过去自己托管的wordpress。

我删除了我的提供商的CNAME DNS配置。

我已经在 forum.domain.com 上有一个运行良好的phpBB论坛。

现在我尝试通过apache2设置虚拟主机。在/var/www/domain.com中创建目录,然后我尝试重启apache2,失败了。 (通过文件夹的mkdir和之后的a2ensite)

systemctl | tails

说问题出在我的letsencrypt配置

enter image description here

<IfModule mod_ssl.c>
<VirtualHost *:443>
        <IfDefine config_ssl>
            ServerAdmin ${config_serveradmin}
            ServerName ${config_servername}
            DocumentRoot /var/www/${config_servername}/public_html

            SSLEngine on

            SSLCertificateFile /etc/letsencrypt/live/${config_servername}/fullchain.pem
            SSLCertificateKeyFile /etc/letsencrypt/live/${config_servername}/privkey.pem
     </IfDefine>
</VirtualHost>

更具体地说,

SSLCertificateFile /etc/letsencrypt/live/${config_servername}/fullchain.pem

我检查了文件夹,但无法找到 domain.com 的任何文件夹。只有 forum.domain.com

的文件夹

enter image description here

该网站的完整配置是

#
#  Domain Configuration
#

# Configuration
Define config_servername domain.com
Define config_serveralias domain.com
Define config_serveradmin admin@domain.com
Define config_ssl true

#
#
#

<VirtualHost *>
        ServerAdmin ${config_serveradmin}
        ServerName  ${config_servername}
        ServerAlias ${config_serveralias}

        # Indexes + Directory Root.
            DirectoryIndex index.php index.html
        DocumentRoot /var/www/${config_servername}/public_html

        # CGI Directory
        ScriptAlias /cgi-bin/ /var/www/${config_servername}/cgi-bin/
        <Location /cgi-bin>
                Options +ExecCGI
        </Location>

        # Logfiles
        ErrorLog  /var/www/${config_servername}/logs/error.log
        CustomLog /var/www/${config_servername}/logs/access.log combined
        <IfDefine config_ssl>
          RewriteEngine on
          RewriteCond %{SERVER_NAME} =${config_servername}
          RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
        </IfDefine>

</VirtualHost>

#
#   Enable .htaccess
#
<Directory "/var/www/${config_servername}/public_html">
        AllowOverride All
</Directory>

#
# SSL Configuration
#

<IfModule mod_ssl.c>
<VirtualHost *:443>
        <IfDefine config_ssl>
            ServerAdmin ${config_serveradmin}
            ServerName ${config_servername}
            DocumentRoot /var/www/${config_servername}/public_html

            SSLEngine on

            SSLCertificateFile /etc/letsencrypt/live/${config_servername}/fullchain.pem
            SSLCertificateKeyFile /etc/letsencrypt/live/${config_servername}/privkey.pem
     </IfDefine>
</VirtualHost>

</IfModule>

UnDefine config_serveradmin
UnDefine config_servername
UnDefine config_serveralias
UnDefine config_ssl

如何解决让我们加密?

1 个答案:

答案 0 :(得分:0)

当我将#添加到Define config_ssl true

时,它重新启动了apache2
#Define config_ssl true