Php 为什么nginx将phtml文件加载为html文件

Php 为什么nginx将phtml文件加载为html文件,php,nginx,magento2,Php,Nginx,Magento2,我的站点在apache服务器上运行得非常好。现在我正尝试在nginx服务器上实现,我遇到了一些问题,比如我的magento的phtml文件执行为html。我尝试并在nginx配置文件中添加了“*.phtml”扩展名,但没有成功 这里是我的配置文件 cat /etc/nginx/sites-enabled/mydomain.com server { listen 80 default_server; root /usr/share/nginx/mydomain.com/; index in

我的站点在apache服务器上运行得非常好。现在我正尝试在nginx服务器上实现,我遇到了一些问题,比如我的magento的phtml文件执行为html。我尝试并在nginx配置文件中添加了“*.phtml”扩展名,但没有成功

这里是我的配置文件

cat /etc/nginx/sites-enabled/mydomain.com 


server {
listen 80 default_server;

root /usr/share/nginx/mydomain.com/;
index index.php index.phtml index.html index.htm;

server_name domain.com;
location / {
    try_files $uri $uri/ /index.php;
}

location ~ \.(php|phtml)$ {
    fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    include snippets/fastcgi-php.conf;
}
}
请建议如何将nginx中的.html文件解析为.phtml?

尝试以下方法:

location ~ \.(php|phtml)$ {
    fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    include snippets/fastcgi-php.conf;
}