[AWS] Ubuntu + Nginx + PHP 설치

91Savage·2022년 10월 31일
0

Server

목록 보기
3/24
  1. sudo apt-get install update

  2. sudo apt-get install upgrade

  3. sudo apt-get install nginx php7.4 php7.4-fpm

  4. 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;
}

이렇게 수정

[PHP 테스트]

 # 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 ;
        

[PHP info 확인]

/var/www/html 디렉토리에 index.php 생성

<?php phpinfo(); ?>

입력

[재시작]

/etc/init.d/php7.4-fpm restart

0개의 댓글