子域名中安装了 ssl,但未显示内容

子域名中安装了 ssl,但未显示内容

我们在 GoDaddy 上有一个 3 年标准 UCC SSL 证书,我添加了 2 个 SAN - 一个在另一个域中,一个在子域中。添加的域在 https 中没有问题。我已经在子域中完全安装了 SSL,但子域的内容正在显示Error establishing a database connection

这不应该发生,因为子域名的内容就index.phphello world里面。

我已经向 GoDaddy 询问该怎么做,但他们帮不上忙。他们说这与我们的托管有关,但我们使用的是 VPS,而且我只通过服务器安装了 SSL。

我的猜测是,也许它不起作用是因为主域不在,https://因为我总是在 Wordpress 中看到错误:Error establishing a database connection但我不确定。

编辑

这是我的配置文件的内容:

<VirtualHost *:80>
ServerName subdomain.example.com
Redirect permanent / https://subdomain.example.com
<Directory /var/www/subdomain_directory>
    Options FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerAdmin [email protected]
ServerName subdomain.example.com
DocumentRoot /var/www/subdomain_directory
<Directory /var/www/subdomain_directory>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
        Require all granted
</Directory>

SSLEngine on
SSLCertificateFile /etc/apache2/SSL/subdomain.example.com.crt
SSLCertificateKeyFile /etc/apache2/SSL/subdomain.example.com.key
SSLCACertificateFile /etc/apache2/SSL/intermediate.crt
</VirtualHost>

答案1

我已在我的配置文件中添加了此项:

DocumentRoot /var/www/subdomain_directory

现在看起来像:

<VirtualHost *:80>
ServerName subdomain.example.com
Redirect permanent / https://subdomain.example.com
<Directory /var/www/subdomain_directory>
    Options FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerAdmin [email protected]
ServerName subdomain.example.com
DocumentRoot /var/www/subdomain_directory
<Directory /var/www/subdomain_directory>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
        Require all granted
</Directory>

SSLEngine on
SSLCertificateFile /etc/apache2/SSL/subdomain.example.com.crt
SSLCertificateKeyFile /etc/apache2/SSL/subdomain.example.com.key
SSLCACertificateFile /etc/apache2/SSL/intermediate.crt
</VirtualHost>

相关内容