뭐든 즐기면서 ;)

Docker NginX 설치 및 설정하기 본문

서버/Docker

Docker NginX 설치 및 설정하기

Tada.*+ 2022. 10. 6. 14:40
728x90

1. NginX 설치 명령어

# nginx:latest version 이미지 가져오기
> docker pull nginx

# docker run [--name 컨테이너 명칭] -d -p [remote server port]:[docker 네트워크 port] [이미지명]
> docker run --name nginx -d -p 80:80 nginx

2. NginX 페이지 띄워보기

3. Docker 내부의 NginX 접근

> docker exec -it [name || 컨테이너ID] /bin/sh

# 컨테이너에서 나오기
> ctrl + d

4. NginX 설정 파일 수정

# pwd
/ (처음 container 진입하면 container 내에 root 경로로 진입한다.)

<!-- nginx.conf 파일이 있는 곳으로 이동하여 파일 열기 -->
# cd /etc/nginx
# vim nginx.conf

* nginx.conf 파일 수정은 참고하여 직접 수정해 주시면 됩니다. https://tadaiswhatever.tistory.com/94


* 만약 vim 명령어가 없다고 하면, 설치해 주어야 합니다.

# apt-get update
Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:2 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Get:4 http://deb.debian.org/debian bullseye/main amd64 Packages [8184 kB]
Get:5 http://deb.debian.org/debian-security bullseye-security/main amd64 Packages [187 kB]
Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [6344 B]
Fetched 8586 kB in 2s (5178 kB/s)
Reading package lists... Done

# apt-get install vim

 

728x90

'서버 > Docker' 카테고리의 다른 글

docker log 위치  (0) 2024.01.10
Erro : WARNING: IPv4 forwarding is disabled. Networking will not work.  (0) 2022.10.12
Docker network 설정  (0) 2022.10.06
CentOS Docker install / CentOS Docker 설치  (0) 2022.10.06
Comments