访问网站通过HTTPS是打破数据库连接

问题描述:

我有一个笨点的Apache Web服务器 上运行我安装letsencrypt访问网站通过HTTPS是打破数据库连接

我的网站能正常工作的SSL,如果我通过http://example.com

,但访问它,

如果我访问它通过https://example.com的网站显示,但该数据库被打破

这是我的htaccess文件

“数据库损坏”:
Include /etc/phpmyadmin/apache.conf 
<VirtualHost *:80> 
     ServerName example.org 
     ServerAlias www.example.org 
     ServerAdmin [email protected] 
     DocumentRoot /var/www/html 
     RewriteEngine on 
     RewriteRule "^/resources/(.+)" "https://example.org/_resources/$1"$ 
     ErrorLog ${APACHE_LOG_DIR}/error.log 
     CustomLog ${APACHE_LOG_DIR}/access.log combined 
     <Directory /var/www/html> 
       Options Indexes FollowSymLinks MultiViews 
       AllowOverride All 
       Order allow,deny 
       allow from all 
     </Directory> 
     ProxyPass /api https://localhost:8010/api 
     ProxyPassReverse /api https://localhost:8010/api 
</VirtualHost> 
<IfModule mod_ssl.c> 
<VirtualHost *:443> 
    ServerName example.org 
    ServerAlias www.example.org 
    DocumentRoot /var/www/html/ 
    Include /etc/letsencrypt/options-ssl-apache.conf 
    SSLEngine on 
    SSLCertificateFile /etc/letsencrypt/live/example.org-0001/cert.pem 
    SSLCertificateKeyFile /etc/letsencrypt/live/example.org-0001/privkey.pem 
    SSLCertificateChainFile /etc/letsencrypt/live/example.org-0001/chain.pem 
</VirtualHost> 
+1

你能更仔细地描述的内修复了这个问题。究竟发生了什么? –

+0

所以当我用“http”打我的网站时,一切正常,所有链接,从数据库中提取的所有动态内容一切正常。当我通过“https”访问我的网站时,只有主页可以正常工作,但没有链接也可以正常工作,主页上的动态内容为空白。 – Tsea

通过添加<VirtualHost *:443>标签

<Directory /var/www/html> 
     AllowOverride All 
    </Directory>