• Saltar a la navegación principal
  • Saltar al contenido principal
  • Saltar al pie de página
labarta

Labarta

  • Blog
  • Vídeos Docker
  • Vídeos entrevistas
  • Dominios
  • Hosting
  • Quién soy

"docker-compose" para WordPress - Nginx

06/04/2020

docker-compose-labarta

 

"docker-compose" para WordPress - Nginx

Seguimos con la serie sobre "docker-compose" para WordPress.

Este es el undécimo artículo sobre "docker-compose" para WordPress - Te aconsejo, si no lo has hecho ya, que leas los anteriores.

  1. "docker-compose" para WordPress -paso a paso -intro
  2. "docker-compose" para WordPress -paso a paso -restart
  3. "docker-compose" para WordPress -paso a paso -volumes
  4. "docker-compose" para WordPress -paso a paso -phpmyadmin
  5. "docker-compose" para WordPress -paso a paso -environment
  6. "docker-compose" para WordPress -paso a paso -multiarranque
  7. "docker-compose" para WordPress -paso a paso -plugins-temas
  8. "docker-compose" para WordPress -paso a paso -plugins-temas-configuración
  9. "docker-compose" para WordPress -paso a paso -mariadb
  10. "docker-compose" para WordPress -paso a paso -adminer

 

Es posible que en tu Hosting tengas "Nginx" y que entonces quieras insertarlo en el "docker-compose" para trabajar en local igual que en el Hosting, incluso poner las mismas versiones en los diferentes servicios.

En esta ocasión copiamos la carpeta 09 a la nueva que creamos como "10" .

Y seguimos con más cambios, primero creamos la carpeta "nginx" y en ella añadimos la carpeta "conf.d" y también agregamos el archivo "nginx.conf " .

Dentro de este archivo va este código:

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
}

Ahora dentro de la carpeta "conf.d" creamos el archivo "default.conf " .

Dentro de este archivo va este código:

server {
listen 80;
server_name 127.0.0.1;
root /var/www/html;
index index.php;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass wordpress:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}

 

Seguimos, en el archivo "docker-compose" en el servicio "wordpress" cambiamos la línea "image" por esta:

image: wordpress:5.3.2-php7.4-fpm-alpine

( para que funcione "nginx" debe tener este tipo de "tag" )

Y ahora agregamos todo el servicio: "nginx" :

nginx:
container_name: nginx-10
image: nginx:1.17.8-alpine
ports:
- "8100:80"
depends_on:
- wordpress
restart: "no"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/conf.d:/etc/nginx/conf.d
- ./nginx/log:/var/log/nginx
- ./wordpress:/var/www/html
networks:
- wp-10

 

Y modificamos todo a 10, container_name, ports y networks.

Bueno vamos al editor de código y arrancamos los cuatro servicios con el comando:

docker-compose up -d

Y vamos a ver...en localhost:8100 todo funciona perfecto.

Añadimos y activamos el plugin "Version-info" para ver que funciona el servicio "nginx" .

 

nginx-10

 

También vemos en localhost:8090 el panel de "Adminer" .

 

adminer-10

 

En el próximo artículo vamos a hacer una recopilación de todas las carpetas creadas y añadir todo lo visto a nuestro fichero "docker-compose" .

 

Al finalizar esta serie de artículos sobre "docker-compose" tendrás disponible para descarga un archizo "Zip" con todas las carpetas creadas y todo el código empleado.

 


Si te ha gustado este artículo, por favor, comparte - Gracias -


Artículos Relacionados

  • portada-organizr-2 Cómo instalar Organizr usando Docker-compose
  • portada-budgetzero-2 Cómo instalar Budgetzero + CouchDB usando Docker-compose
  • portada-mirotalk-2 Cómo instalar MiroTalk SFU usando docker-compose
  • portada-openkm-2 Cómo instalar OpenKm usando docker-compose

Blog,  Docker docker-compose

  • Todas las entradas
  • Github
  • Meetup WordPress
  • Política de cookies

Footer

GINERNET - Servidor VPS

Ginernet

GeneratePress - Tema WordPress

GeneratePress

GINERNET - Hosting WordPress

Ginernet2

OnlyOffice - Online Office

Usamos ONLYOFFICE Online Office

Copyright © 2025 · Labarta - Powered by : Labarta

Usamos cookies en nuestro sitio web para brindarle la experiencia más relevante recordando sus preferencias y visitas repetidas. Al hacer clic en “Aceptar todo”, acepta el uso de todas las cookies. Sin embargo, puede visitar "Configuración cookies" para proporcionar un consentimiento controlado.
Configuración cookiesAceptar todo
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Siempre activado
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDuraciónDescripción
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
GUARDAR Y ACEPTAR