sudo apt-get install update
sudo apt-get install upgrade
sudo apt-get install nginx php7.4 php7.4-fpm
vi /etc/nginx/sites-available/default 파일 열기
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
# fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
#}
를
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
이렇게 수정
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html ;
에 끝부분에 index.php 추가
index index.html index.htm index.nginx-debian.html index.php ;
/var/www/html 디렉토리에 index.php 생성
<?php phpinfo(); ?>
입력
/etc/init.d/php7.4-fpm restart