본문 바로가기
Linux

[Linux] Ubuntu20.04 Nginx 설치 및 설정

by sky-j 2023. 7. 25.
반응형
# Stop Nginx
sudo systemctl stop nginx

# Start Nginx
sudo systemctl start nginx

# Restart Nginx
sudo systemctl restart nginx

 Nginx 란?

  • Nginx는 경량 웹 서버
  • 클라이언트로부터 요청을 받았을 때 요청에 맞는 정적 파일을 응답해주는 HTTP Web Server로 활용 또는 Reverse Proxy Server로 활용하여 WAS 서버의 부하를 줄일 수 있는 로드 밸런서로 활용 됩니다.
  • 자세한 내용은 다음에 다뤄보도록 하겠습니다.

패키지 업데이트

sudo apt update

Nginx 설치

sudo apt install nginx

Nginx 서비스 상태 확인

sudo systemctl status nginx

nginx 상태 확인

Nginx 중지, 시작, 다시시작 명령어

# Stop Nginx
sudo systemctl stop nginx

# Start Nginx
sudo systemctl start nginx

# Restart Nginx
sudo systemctl restart nginx

Nginx 구성

1-1. 디렉토리 생성 과 동시에 my_configuration파일 생성

sudo vi /etc/nginx/sites-available/my_configuration

1-2. Symbolic link를 생성하여 구성을 활성화

sudo ln -s /etc/nginx/sites-available/my_configuration /etc/nginx/sites-enabled/

1-3. Nginx 구성에서 구문 오류 테스트

sudo nginx -t

1-4. Nginx 리로드

sudo systemctl relocad nginx

 

반응형