cancel
Showing results for 
Search instead for 
Did you mean: 

why nginx load phtml files as html files in magento 2

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

why nginx load phtml files as html files in magento 2

Hello,

 

My site runs perfectly on apache server.

Now i am tring to implement on nginx server and i have problem like my magento's phtml files executes as html.

I tried and added "*.phtml" extension in nginx config file but not succeed.

 

here my config file:-

 

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;
}
}

 

Please suggest how can i solve ".html" file to ".phtml" in nginx