未解析PHP include in.HTML文件

未解析PHP include in.HTML文件,php,html,nginx,server-side-rendering,ssi,Php,Html,Nginx,Server Side Rendering,Ssi,从Apache(Godaddy)迁移到Nginx(DigitalOcean),index.html中下面的PHP代码不起作用,因此,站点的页脚部分消失了。它可以在旧服务器上正常工作 <? include("includes/copyright.php") ?> 在您的nginx配置中,更新以location~\.php(/|$){开头的行,并使用: location ~ \.(php|html|htm)$ { 然后重新启动服务。这将允许通过php解析htm

从Apache(Godaddy)迁移到Nginx(DigitalOcean),index.html中下面的PHP代码不起作用,因此,站点的页脚部分消失了。它可以在旧服务器上正常工作

<? include("includes/copyright.php") ?>


在您的nginx配置中,更新以
location~\.php(/|$){
开头的行,并使用:

location ~ \.(php|html|htm)$ {
然后重新启动服务。这将允许通过php解析html文件

如果传递给fastcgi不起作用,您可以向php fpm配置中添加一个指令:

security.limit_extensions = .php .html 

所以你把php代码放在了.html文件中?它可能正确地包含了它,但没有处理它,因为“父”页面是.html,不是.php。你能发布你的nginx配置吗?你使用的是php fpm吗?假设你使用,你可以调整security.limit\u extensions中定义的扩展以包括。html@forloopsnginx conf已上载。@droopsnoot这在旧Apache服务器上运行正常。它在迁移到nginx后停止工作。我是否需要启动任何其他服务器服务器除了nginx?更新了“/etc/nginx/sites available/mysite.com.conf”之外,还重新启动了服务器,但仍然存在相同的问题。在/etc/php/7.4/fpm/php-fpm.conf中添加了“security.limit_extensions=.php.html”,然后重新启动了服务器,但仍然运气不好!
security.limit_extensions = .php .html