我已經(jīng)根據(jù)此 linode 指南設(shè)置了 php/apache:https://www.linode.com/docs/guides/install-php-8-for-apache-and-nginx-on-ubuntu/
這似乎有效,我有一個(gè) apache 服務(wù)器,可以提供文件服務(wù),并處理 .php
文件。
但是,我正在花時(shí)間弄清楚如何告訴 apache 使用 .php
處理 .html 文件。我對(duì) .htaccess
(a-la- https://manage.accuwebhosting.com/knowledgebase/2492/Parse-HTML-As-PHP-Using-HTACCESS-File.html 等)所做的任何修改都不會(huì)產(chǎn)生任何變化。我還將 AllowOverride All
設(shè)置為 /etc/apache2/apache2.conf
中的 /var/www/
目錄。此外,大多數(shù)有關(guān)該主題的在線(xiàn)信息都指向 .php
的早期版本,沒(méi)有具體提及 8.0
。
什么可以讓apache用
8.0
處理.html
?
您需要為此模塊,確認(rèn)您在 httpd.conf 中有此行??,或?qū)⑵涮砑拥狡渲校?/p>
LoadModule mime_module modules/mod_mime.so
另請(qǐng)檢查您的系統(tǒng)上是否存在 modules/mod_mime.so
文件。
然后在httpd.conf中找到或添加模塊部分:
# following line will change mime type of .html file to php # and they will be handled as such AddType application/x-httpd-php .html
指令 AllowOverride All
將啟用 .htaccess 文件,但您還需要啟用 mime_module。
當(dāng)然,在更改配置后重新啟動(dòng) apache 服務(wù)器。
模塊文檔:此處