This question already has an answer here:
- HTML files as PHP in Nginx 4 answers
I have the following config:
server {
listen 80 default_server;
access_log /var/www/logs/access.log;
error_log /var/www/logs/error.log error;
root /var/www/web/;
index index.html index.php;
server_name _;
location / {
try_files $uri $uri/ =404;
}
# HACK: This is temporary to work around renaming dozens of HTML links
location ~ \.htm$ {
root html;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.htm;
include fastcgi_params;
}
# HACK: This is temporary to work around renaming dozens of HTML links
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
And I updated /etc/php5/fpm/pool.d/www.conf adding the line:
security.limit_extensions = .php .html
Restarted FPM and NGINX but when I access .html files the PHP is not rendered...*.php files execute as expected...
What else am I missing???
I would remove this:
And use this instead:
I hope this solves your issue.