この記事はcentos7+nginx+php7の環境で書いています。
やりたいこと
Apacheのときにこんな感じで書いていました。
httpd.conf
AddType application/x-httpd-php .html
これをnginxで設定したい。
PHP-FPM
# vi /etc/php-fpm.d/www.conf
www.conf
security.limit_extensions = .php .php3 .php4 .php5 .html
NGINX
必要なディレクティブに下記を加える。
location ~ \.html$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.html;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
最後に
再起動を忘れずに
# systemctl reload php-fpm.service
# systemctl reload nginx.service