How can I instruct nginx to interpret an individual file as php

Posted by codecowboy on Server Fault See other posts from Server Fault or by codecowboy
Published on 2014-06-06T08:32:39Z Indexed on 2014/06/06 9:27 UTC
Read the original article Hit count: 143

Filed under:

A legacy application relies on the following .htaccess rule for an individual file

<Files MyFile.html>
AddType application/x-httpd-php .html
</Files>

The new machine has nginx and php-fpm installed with the following config:

location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;

}

© Server Fault or respective owner

Related posts about nginx