WordPress sobre HTTPS con Docker (SSL)

Qué

Fue bastante difícil hacer que https fuera mi sitio de WordPress cuando usaba Docker

Porque necesitaba hacer un servidor proxy Nginx y conectarlo

Cómo

(He usado AWS EC2 ubuntu)

  1. abra el puerto 443 en su grupo de seguridad

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

Aquí está mi ejemplo de trabajo

## 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

Aquí está mi ejemplo de trabajo

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: Dockerize su aplicación Golang con la base de datos PostgreSQL.

DevOps-1: Dockerize su aplicación Golang con la base de datos PostgreSQL.

En este artículo, intentaremos dockerizar una aplicación CRUD simple de golang con una base de datos postgreSQL. Primero creemos nuestra aplicación.

DevOps-2: Dockerize su aplicación Golang con la base de datos PostgreSQL.

DevOps-2: Dockerize su aplicación Golang con la base de datos PostgreSQL.

Si quieres leer la primera parte, haz click aquí Soo! ¡Hola gente buena! Gracias por continuar leyendo la segunda parte de la serie para dockerizar su aplicación golang con la base de datos postgresql. En el último artículo, escribimos un programa de aplicación golang CRUD simple y ejecutamos la aplicación acoplando la base de datos postgreSQL.

Related posts

Lo que puede hacer en su temporada de espera (esperando conseguir su primer trabajo en tecnología)

Lo que puede hacer en su temporada de espera (esperando conseguir su primer trabajo en tecnología)

Cambiar a una nueva carrera puede ser extremadamente desafiante si trata de hacerlo solo. Es importante encontrar socios responsables que estén en el mismo nivel de aprendizaje que usted, que compartan objetivos, tenacidad e impulso similares.

Ese Archivo de Amenazas: Vol 7 Black Basta

Ese Archivo de Amenazas: Vol 7 Black Basta

En el mundo interconectado de hoy, la amenaza de los ataques cibernéticos es más frecuente que nunca. Los ciberdelincuentes y los actores del estado-nación buscan constantemente explotar las vulnerabilidades y robar datos valiosos, lo que representa un riesgo significativo para las organizaciones de todos los tamaños.

¿Qué hace que un podcast sea influyente?

¿Qué hace que un podcast sea influyente?

La semana pasada noté un comunicado de prensa, enviado a través de PressGazette (un sitio web de noticias de los medios británicos). El artículo anunciaba que Acast, la empresa de publicidad y alojamiento de podcasts de Scandi, lideraría un consorcio de editores "probablemente los más influyentes" en podcasting.

La mentira del vaquero

Cómo las megacorporaciones vendieron a los estadounidenses una falsedad fornida

La mentira del vaquero

Es una mañana brillantemente dorada en las ondulantes colinas del oeste, mientras los primeros rayos del sol iluminan la hierba escarchada de las llanuras. Una manada de ganado Angus plácido, negro azabache y enorme, se recorta contra el amanecer mientras avanzan por un sendero trillado hacia un lugar que todos conocen bien; la barra de desayuno