使用 centos 操作系统和 apache 2.2.3
我的 php 代码未通过 ssl 解释。它在浏览器中呈现代码。页面在 http 下运行良好。
配置:
<VirtualHost secure.cognitionsmartsites.com:443>
AddType text/html .php
AddHandler application/x-httpd-php .php
ServerName secure.cognitionsmartsites.com
<Directory "/var/www/vhosts/default/htdocs">
Allow from all Options +Indexes
</Directory>
IndexOptions
ServerAlias secure.cognitionsmartsites.com
DocumentRoot /var/www/vhosts/default/htdocs
SSLEngine On
SSLCertificateFile /usr/local/psa/var/certificates/cert.crt
SSLCertificateKeyFile /usr/local/psa/var/certificates/private.key
SSLCertificateChainFile /usr/local/psa/var/certificates/intermediate.crt
</VirtualHost>
httpd -S 输出
VirtualHost configuration:
192.168.0.1:80 siteeditor.vserver.onlinehome-server.info (/etc/httpd/conf.d/zz011_siteeditor.conf:8)
127.0.0.1:80 siteeditor.vserver.onlinehome-server.info (/etc/httpd/conf.d/zz011_siteeditor.conf:8)
74.208.101.55:80 default (/etc/httpd/conf.d/zz010_psa_httpd.conf:48)
74.208.101.55:443 secure.cognitionsmartsites.com (/etc/httpd/conf.d/smartsitessl.conf:3)
wildcard NameVirtualHosts and _default_ servers:
_default_:443 s15441819.onlinehome-server.com (/etc/httpd/conf.d/ssl.conf:81)
*:80 is a NameVirtualHost
default server s361865982.onlinehome.us (/etc/httpd/conf/httpd.conf:989)
port 80 namevhost s361865982.onlinehome.us (/etc/httpd/conf/httpd.conf:989)
Syntax OK
另一件事是,我可以浏览 https 下的图像文件,并且它们可以很好地呈现。
答案1
只需删除:
AddType text/html .php
由于你的 php 文件是 php 文件,而不是纯文本内容