Take the 2-minute tour ×

How can I allow nginx to parse php code into a file with .htm extension, at a specific directory?

I need this, because I migrated from apache, and changing all file extensions would be a big headache.


share|improve this question

1 Answer 1

This snippet from default nginx.conf, replace .php to .htm in location ... and enjoy.

# pass the PHP scripts to FastCGI server listening on
#location ~ \.php$ {
#    root           html;
#    fastcgi_pass;
#    fastcgi_index  index.php;
#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
#    include        fastcgi_params;
share|improve this answer

Your Answer


