인셉션의 경우, 만들어진 nginx를 가져오는 것이 아닌 빈 운영체제 위에서 nginx를 깔아야 함.
- 운영체제 (OS) =
debian:bullseye - conf 파일 역시 필요하다.
1. 테스트 해보기
순수한 데비안을 올려보고, 직접 명령어를 쳐 가면서 무엇이 필요할까 생각해본다.
bash
docker run -it debian:buster /bin/sh
2. nginx.conf 작성하기
nix
server {
# 서버의 리스닝 포트 설정
listen 443 ssl;
# 서버의 기본 도메인 설정
server_name $DOMAIN_NAME;
# 기본 페이지 설정
root /var/www/html;
index index.php index.html index.htm;
# SSL Protocol 설정
ssl_protocols TLSv1.3;
ssl_certificate /etc/nginx/ssl/my_ssl.crt;
ssl_certificate_key /etc/nginx/ssl/my_ssl.key;
# URI 처리 패턴
location / {
# URI가 있으면 그대로, 없으면 index.php$sargs로.
try_files $uri $uri/ /index.php?sargs;
}
location ~ \.php$ {
include fastcgi.conf;
fastcgi_pass my_wordpress:9000; # 모든 요청을 my_wordpress:9000으로
fastcgi_index index.php; # 기본적으로 반환할 php 파일
}
}