Answer the question
In order to leave comments, you need to log in
How to make nginx interpret html files as php?
There is an nginx+phpfpm server.
Files with the .php extension are returned normally, but in the .htm/.html files, the php code is returned as source text without being broadcast. How to make nginx broadcast html files with php code?
Answer the question
In order to leave comments, you need to log in
I suggested it in a comment to the question, I'm posting it as an answer (for those who encounter this problem).
1. nginx should pass html files to the fastcgi backend. To do this, you need to change the Location, where the processing of php files is registered, or add a new Location.
location ~ .(php|html)$ {
fastcgi_pass ...
fastcgi_index index.php;
fastcgi_param ...
include fastcgi_params;
}
security.limit_extensions = .php .html
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question