Rocky Linux 9 선택 이유
CentOS 8이 2021년 말 지원 종료되면서 많은 서버 관리자들이 Rocky Linux로 이전하고 있습니다. RHEL 1:1 호환성을 유지하면서 무료로 사용할 수 있는 엔터프라이즈급 배포판입니다.
1단계 — 시스템 업데이트
dnf update -y
dnf install -y epel-release
2단계 — Nginx 설치
dnf install -y nginx
systemctl enable --now nginx
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
3단계 — PHP 8.2 + PHP-FPM 설치
dnf install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm
dnf module enable -y php:remi-8.2
dnf install -y php php-fpm php-mysqlnd php-mbstring php-xml php-gd
4단계 — Nginx + PHP-FPM 연동
server {
listen 80;
server_name example.com;
root /var/www/html;
index index.php index.html;
location ~ \.php$ {
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
systemctl enable --now php-fpm
systemctl restart nginx