인프라

Centos8 httpd2.4 + php7.4 html 확장자 추가

소행성왕자 2021. 11. 8. 11:05

html 에서 php 사용할수 있도록 추가해 봅시다.

FilesMatch 부분에 html 을 추가합시다. 

2군데 해줘야 합니다.

$vi /etc/httpd/conf.d/php.conf 
<IfModule  mod_php7.c>
    #
    # Cause the PHP interpreter to handle files with a .php extension.
    #
    <FilesMatch \.(php|phar|html)$>
        SetHandler application/x-httpd-php
    </FilesMatch>

    ...
    ...
    <IfModule !mod_php5.c>
        <IfModule !mod_php7.c>
          # Enable http authorization headers
          SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
      
          <FilesMatch \.(php|phar|html)$>
              SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost"
          </FilesMatch>
        </IfModule>
      </IfModule>

php-fpm 에 .html 확장자를 추가합시다.

$vi /etc/php-fpm.d/www.conf 
;security.limit_extensions = .php .php3 .php4 .php5 .php7
security.limit_extensions = .php .html
$service php-fpm restart
$apachectl restart