Docker (SSL)를 사용하는 HTTPS를 통한 WordPress

뭐

Docker를 사용할 때 https를 내 WordPress 사이트로 만드는 것이 매우 어려웠습니다.

Nginx 프록시 서버를 만들고 연결해야했기 때문에

어떻게

(AWS EC2 우분투를 사용했습니다)

  1. 보안 그룹에서 443 포트 열기

mkdir nginx-proxy && cd nginx-proxy
git clone https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion.git .
mv .env.sample .env && vim .env

다음은 내 작업 예입니다.

## Set the IP address of the external access Interface
#
IP=0.0.0.0
#
# Default Network
#
NETWORK=webproxy
# If you want to customize the created network, use the following variable
#NETWORK_OPTIONS="--opt encrypted=true"
#
# Service Network (Optional)
#
# In case you decide to add a new network to your services containers you can set this
# network as a SERVICE_NETWORK
#
# [WARNING] This setting was built to use our `start.sh` script or in that special case
#           you could use the docker-composer with our multiple network option, as of:
#           `docker-compose -f docker-compose-multiple-networks.yml up -d`
#
#SERVICE_NETWORK=webservices
# If you want to customize the created network, use the following variable
#SERVICE_NETWORK_OPTIONS="--opt encrypted=true"
#
# NGINX file path#
NGINX_FILES_PATH=/var/nginx/data
## docker-compose-letsencrypt-nginx-proxy-companion
#
# A Web Proxy using docker with NGINX and Let's Encrypt
# Using the great community docker-gen, nginx-proxy and docker-letsencrypt-nginx-proxy-companion
#
# This is the .env file to set up your webproxy enviornment
#
# Your local containers NAME
#
NGINX_WEB=nginx-web
DOCKER_GEN=nginx-gen
LETS_ENCRYPT=nginx-letsencrypt
#
# NGINX use special conf files
#
# In case you want to add some special configuration to your NGINX Web Proxy you could
# add your files to ./conf.d/ folder as of sample file 'uploadsize.conf'
#
# [WARNING] This setting was built to use our `start.sh`.
#
# [WARNING] Once you set this options to true all your files will be copied to data
#           folder (./data/conf.d). If you decide to remove this special configuration
#           you must delete your files from data folder ./data/conf.d.
#
#USE_NGINX_CONF_FILES=true
#
# Docker Logging Config
#
# This section offers two options max-size and max-file, which follow the docker documentation
# as follow:
#
# logging:
#      driver: "json-file"
#      options:
#        max-size: "200k"
#        max-file: "10"
#
#NGINX_WEB_LOG_DRIVER=json-file
#NGINX_WEB_LOG_MAX_SIZE=4m
#NGINX_WEB_LOG_MAX_FILE=10
#NGINX_GEN_LOG_DRIVER=json-file
#NGINX_GEN_LOG_MAX_SIZE=2m
#NGINX_GEN_LOG_MAX_FILE=10
#NGINX_LETSENCRYPT_LOG_DRIVER=json-file
#NGINX_LETSENCRYPT_LOG_MAX_SIZE=2m
#NGINX_LETSENCRYPT_LOG_MAX_FILE=10

./start.sh

cd .. && mkdir wordpress-letsencrypt && cd wordpress-letsencrypt
git clone https://github.com/evertramos/docker-wordpress-letsencrypt.git .
vim docker-compose.yml

다음은 내 작업 예입니다.

version: '3'
services:
  db:
    container_name: ruucm-db-container
    image: mariadb:latest
    restart: unless-stopped
    volumes:
      - ${DB_PATH}:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: superstrongpw123
      MYSQL_DATABASE: ruucm-db
      MYSQL_USER: root
      MYSQL_PASSWORD: superstrongpw123
wordpress:
    depends_on:
      - db
    container_name: ruucm-wp-container
    image: wordpress:latest
    restart: unless-stopped
    volumes:
      - ${WP_CORE}:/var/www/html
      - ${WP_CONTENT}:/var/www/html/wp-content
    environment:
      WORDPRESS_DB_HOST: ruucm-db-container:3306
      WORDPRESS_DB_NAME: ruucm-db
      WORDPRESS_DB_USER: root
      WORDPRESS_DB_PASSWORD: superstrongpw123
      WORDPRESS_TABLE_PREFIX: wp_
      VIRTUAL_HOST: ruucm.work, www.ruucm.work
      LETSENCRYPT_HOST: ruucm.work, www.ruucm.work
      LETSENCRYPT_EMAIL: [email protected]
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: phpmyadmin
    external_links:
      - db
    ports:
      - 8181:80
    environment:
      MYSQL_USERNAME: root
      MYSQL_ROOT_PASSWORD: superstrongpw123
#   wpcli:
#     image: tatemz/wp-cli
#     volumes:
#       - ${WP_CORE}:/var/www/html
#       - ${WP_CONTENT}:/var/www/html/wp-content
#     depends_on:
#       - db
#     entrypoint: wp
networks:
  default:
    external:
      name: webproxy

mv .env.sample .env && vim .env
# .env file to set up your wordpress site
#
# Network name
#
# Your container app must use a network conencted to your webproxy
# https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion
#
NETWORK=webproxy
#
# Database Container configuration
# We recommend MySQL or MariaDB - please update docker-compose file if needed.
#
CONTAINER_DB_NAME=ruucm-db-container
# Path to store your database
DB_PATH=/var/lib/mysql
# Root password for your database
MYSQL_ROOT_PASSWORD=superstrongpw123
# Database name, user and password for your wordpress
MYSQL_DATABASE=ruucm-db
MYSQL_USER=root
MYSQL_PASSWORD=superstrongpw123
#
# Wordpress Container configuration
#
CONTAINER_WP_NAME=ruucm-wp-container
# Path to store your wordpress files
WP_CORE=/var/www/html
WP_CONTENT=/var/www/html/wp-content
# Table prefix
WORDPRESS_TABLE_PREFIX=wp_
# Your domain (or domains)
DOMAINS=ruucm.work,www.ruucm.work
# Your email for Let's Encrypt register
[email protected]

docker-compose up -d

Suggested posts

DevOps-1: PostgreSQL 데이터베이스로 Golang 애플리케이션을 도커화합니다.

DevOps-1: PostgreSQL 데이터베이스로 Golang 애플리케이션을 도커화합니다.

이 기사에서는 postgreSQL 데이터베이스를 사용하여 간단한 golang CRUD 애플리케이션을 도커화하려고 합니다. 먼저 애플리케이션을 만들어 봅시다.

DevOps-2: PostgreSQL 데이터베이스로 Golang 애플리케이션을 도커화합니다.

DevOps-2: PostgreSQL 데이터베이스로 Golang 애플리케이션을 도커화합니다.

첫 번째 부분을 읽으려면 여기를 클릭하십시오. 수! 이봐 좋은 사람들! postgresql 데이터베이스로 golang 애플리케이션을 도킹하는 방법에 대한 시리즈의 두 번째 부분을 계속 읽어 주셔서 감사합니다. 지난 기사에서 우리는 간단한 golang CRUD 응용 프로그램을 작성하고 postgreSQL 데이터베이스를 도킹하여 앱을 실행했습니다.

Related posts

빨간 머리 소녀의 솔로 퍼포먼스

Hayden의 임무를 맡은 Katie는 자위하는 자신을 촬영합니다.

빨간 머리 소녀의 솔로 퍼포먼스

Hayden이 함께 저녁을 보낸 후 Katie를 대학 기숙사로 데려다 준 것은 자정 이후였습니다. 그녀는 아침에 일찍 수업이 있었고 전날 밤 그와 함께 지낸 후 다시 옷을 갈아입지 않았습니다.

도메인 이름에 대한 정보 찾기

Brian P. Hogan의 Small, Sharp 소프트웨어 도구에서 발췌

도메인 이름에 대한 정보 찾기

facebook.com에 요청하면 컴퓨터가 도메인 이름을 조회하여 해당 도메인 이름을 IP 주소로 변환하므로 컴퓨터가 해당 연결을 만들 수 있습니다.

안전한 작업 환경 조성

안전한 작업 환경 조성

“그는 내가 위험에 처했을 때 나를 지켜줄 것입니다. 그가 나를 그의 천막 안에 숨길 것이다.

취하기의 아이의 첫 번째 책

취하기의 아이의 첫 번째 책

(경고- 이것은 유쾌하게 전복하려는 풍자입니다. 절대 어린이용이 아닙니다.) 당신은 엄마와 아빠가 부엌에 숨어서 그 냄새나는 담배를 피우는 것을 본 적이 있습니다. 그들은 당신에게 말합니다.