当我打开未加密的 phpmyadmin 时,一切都正常。但是,如果我切换到 https,浏览器就会下载索引文件。
apache 000-default.conf 作为
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
###### I tried with and without the next group: with no luck
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName my.server:443
DocumentRoot /var/www/html
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
我的 apache.conf 是默认的(由 phpmyadmin 安装) - 涉及的部分在这里:Alias /phpyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
DirectoryIndex index.php
<IfModule mod_php5.c>
<IfModule mod_mime.c>
AddType application/x-httpd-php .php
</IfModule>
<FilesMatch ".+\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals Off
php_admin_flag allow_url_fopen Off
php_value include_path .
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/
</IfModule>
</Directory>
顺便说一句,我在服务器上有 virtualmin,但我在根目录下安装 phpmyadmin(所以应该像正常安装一样工作,对吗?)
答案1
已解决:apache 000-default.conf 应该直接指向 IP,而不是带有‘*’:
<VirtualHost SERVER_IP:443>
ServerAdmin webmaster@localhost
ServerName my.server:443
DocumentRoot /var/www/html
DocumentRoot /usr/share/phpmyadmin
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>