# nginx.conf
events {}
http {
include mime.types;
server {
listen 80;
server_name lcoal;
root /sites/demo;
index index.php index.html;
location / {
try_files $uri $uri/ =404;
}
location ~\.php$ {
include fastcgi.conf;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
}
}
}
uri 가 .php 로 끝나는 요청의 경우 fastcgi로 처리한다.
/sites/demo/info.php 를 내보낼 때
/run/php-fpm/php-fpm.sock
로 php-fpm에서 처리하고 nginx에게 전달 후 브라우저에게 내보낸다.
에러 발생시 /var/log/nginx/error.log
에서 확인