Ubuntu 24에 Nginx 설치하는 방법

Ubuntu 24에서 Nginx 설치 및 실행 설정 방법을 간단한 명령어 중심으로 정리함.

Ubuntu 24에서 Nginx 설치 및 실행 방법

1. 패키지 목록 업데이트

최신 패키지 정보를 받아오기 위해 아래 명령어를 먼저 실행함.

sudo apt update

2. Nginx 설치

Nginx 웹 서버를 apt를 통해 설치함.

sudo apt install nginx -y

3. Nginx 상태 확인

서비스가 잘 설치되었는지 확인하려면 아래 명령어 사용.

sudo systemctl status nginx

4. Nginx 실행 및 부팅 시 자동 실행 설정

서비스를 수동으로 실행하고, 재부팅 시에도 자동으로 실행되도록 설정함.


sudo systemctl start nginx
sudo systemctl enable nginx

5. 설정 폴더 권한 부여

Jenkins 등 외부에서 설정 파일을 생성할 수 있도록 conf.d 폴더의 소유권을 현재 사용자($USER)로 변경함.

sudo chown -R $USER:$USER /etc/nginx/conf.d

위 단계까지 완료하면 Nginx가 정상적으로 작동하며, 설정 파일 업로드 권한도 확보됨.

한방 명령어 (권한 부여 포함)


sudo apt update && sudo apt install nginx -y && sudo systemctl status nginx && sudo systemctl start nginx && sudo systemctl enable nginx && sudo chown -R $USER:$USER /etc/nginx/conf.d

Was this helpful?

0 / 0

답글 남기기 0

Your email address will not be published. Required fields are marked *