안녕하세요.
쉬운 IT의 시작, 아이티이지(iteasy) 입니다.
오늘은 web/was의 기본 개념 이해를 알아보고,
niginx DB, PHP yum 패키지 설치 방법에 대해서 알아보겠습니다.
🔎 웹 서버(Web Server)란?
웹 서버는 HTTP를 이용하여 클라이언트와 서버의 통신을 의미합니다. 웹 서버는 소프트웨어의
일종이며, 인터넷을 통해 사용자에게 웹 컨텐츠를 전달하는 중요한 역할을 하고 있습니다.

🔎 웹 어플리케이션 서버(Web Application Server)?
웹 어플리케이션 서버, 앱 서버는 WAS라고 불리며, 웹 서버와 동일하게 HTTP 기반으로 동작합니다. 앱 서버의 주요 임무는 동적인 요청을 받아 처리해주는 서버를 말합니다.

▶ 내용에 대한 확인 방법
* 설치 환경: Rocky 8.7 x64 v.1.0
* [root@localhost ~]# cat /etc/redhat-release

1️⃣ nginx 설치하기 (패키지)
1-1. 리포지토리 설정 파일 추가
: nginx 최신 버전 설치를 위해서 epel-release 필요
: epel-release 설치하기 위해서 extras 저장소 설정 파일 필요
① extras 설정 파일 추가
[root@localhost ~]# vi /etc/yum.repos.d/Rocky-Extras.repo

* mirrorlist 주석 처리
* baseurl 주석 해제
② epel-release 저장소 패키지 설치
[root@localhost ~]# dnf -y install epel-release
1-2. nginx 설치
① 설치하기
[root@localhost ~]# dnf -y install nginx
② 설치된 버전 확인
[root@localhost ~]# nginx -v nginx version : nginx/1.14.1
1-3. nginx 실행
① start: 실행
[root@localhost ~]# systemctl start nginx
② status: 상태 확인
[root@localhost ~]# systemctl status nginx
③ enable: 서비스 자동 시작 (부팅 시 자동 시작)
[root@localhost ~]# systemctl enable nginx

2️⃣ DB 설치
2-1. mysql 설치
① 설치 가능한 버전 확인
[root@localhost ~]# dnf whatprovides mysql-server

② 설치하기
[root@localhost ~]# dnf install mysql-server
2-2. mysqld 실행
① start: 실행
[root@localhost ~]# systemctl start mysqld
② status: 상태 확인
[root@localhost ~]# systemctl start mysqld
③ enable: 서비스 자동 시작 (부팅 시 자동 시작)
[root@localhost ~]# systemctl status mysqld

2-3. 접속 확인 및 버전 확인
* [root@localhost ~]# mysql -uroot
* mysql> SELECT VERSION();


3️⃣ PHP 설치
3-1.php 설치
① 설치 가능 버전 리스트 확인
[root@localhost ~]# dnf module list php

② 설치하고 싶은 버전 enabled 설정
[root@localhost ~]# dnf module reset php
[root@localhost ~]# dnf module enable php:7.4

③ 설치
[root@localhost ~]# dnf install php

④ 버전 확인
[root@localhost ~]# php -v

4️⃣ nginx – php 연동하여 phpinfo 페이지 확인
4-1. nginx 폴더 확인
: /etc/nginx/default.d 경로에 php.conf 파일 자동 생성된 것 확인

4-2. nginx.conf 에서 html root 경로 확인
[root@localhost ~]# vi /etc/nginx/nginx.conf


4-3. html root 경로에 phpinfo.php 파일 생성
[root@localhost ~]# vi /usr/share/nginx/html/phpinfo.php
<?php phpinfo(); ?>


4-4. nginx 재시작
[root@localhost ~]# systemctl restart nginx

4-5. phpinfo를 사용해 PHP 확인
주소창에 도메인/파일명.php를 입력하여 php 정보 확인

오늘의 nginx DB, PHP 패키지 설치방법! 어떠셨나요!?
앞으로도 유용한 정보를 알려드리겠습니다. 기대해주세요!
혹시 추가로 궁금하신 내용이 있으시다면, 언제든지 문의해주세요!
감사합니다.
IT is easy, ITEASY
