So I have to setup 2 WP sites and test SSO functionality. When I had one site I was able to use a single (& simple) compose file. But now if I try to do the same thing with 2 sites there is a conflict of ports. The easy way would be to use different ports but I would rather know how to do it correctly. Someone on stackoverflow mentioned this solution but it doesn’t work. Create a compose file that that has proxy & sql. Create another compose file in the root that will be used for the site.
version: "3.3"
services:
photon:
image: "chriszarate/photon:latest"
mysql:
image: "mariadb:10.2"
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
MYSQL_DATABASE: "wordpress"
MYSQL_ROOT_PASSWORD: ""
ports:
- "3306:3306"
proxy:
image: "jwilder/nginx-proxy:alpine"
environment:
HSTS: "off"
HTTPS_METHOD: "nohttps"
ports:
- "80:80"
- "443:443"
volumes:
- "//var/run/docker.sock:/tmp/docker.sock:ro"
- "./certs/self-signed:/etc/nginx/certs:ro"
- "./conf/nginx-proxy.conf:/etc/nginx/conf.d/proxy.conf:ro"
- "./conf/nginx-proxy-wordpress.conf:/etc/nginx/vhost.d /${DOCKER_DEV_DOMAIN}_location:ro"
networks:
default:
external:
name: back
This is the one used for WordPress
version: "3.3"
services:
wordpress:
image: "wordpress:${WP_VERSION:-4.9.8}-php${PHP_VERSION:-7.2}-apache"
environment:
VIRTUAL_HOST: "${DOCKER_DEV_DOMAIN:-project.test}"
WORDPRESS_DB_HOST: "mysql"
WORDPRESS_DB_NAME: "wordpress"
WORDPRESS_DB_PASSWORD: ""
WORDPRESS_DB_USER: "root"
depends_on:
- "mysql"
volumes:
- "wp:/var/www/html:rw"
- "./certs/ca-root/ca.crt:/tmp/certs/root.crt:ro"
- "./conf/php-local.ini:/usr/local/etc/php/conf.d/local.ini:ro"
- "./conf/wp-local-config.php:/usr/local/etc/php/autoprepend.php:ro"
- "./src/vip-go-mu-plugins:/var/www/html/wp-content/mu-plugins"
- "./src/sitename/client-mu-plugins:/var/www/html/wp-content/client-mu-plugins"
- "./src/sitename/images:/var/www/html/wp-content/images"
- "./src/sitename/languages:/var/www/html/wp-content/languages"
- "./src/sitename/plugins:/var/www/html/wp-content/plugins"
- "./src/sitename/private:/var/www/html/wp-content/private"
- "./src/sitename/themes:/var/www/html/wp-content/themes"
- "./src/sitename/vip-config:/var/www/html/wp-content/vip-config"
wp-cli:
container_name: "wp-cli"
image: "wordpress:cli-php${PHP_VERSION:-7.2}"
environment:
- APACHE_RUN_USER="www-data"
- APACHE_RUN_GROUP="www-data"
depends_on:
- "mysql"
networks:
- "back"
volumes:
- "wp:/var/www/html:rw"
- "./bin/install-wp.sh:/usr/local/bin/install-wp:ro"
- "./conf/php-local.ini:/usr/local/etc/php/conf.d/local.ini:ro"
- "./conf/wp-local-config.php:/usr/local/etc/php/autoprepend.php:ro"
- "./src/vip-go-mu-plugins:/var/www/html/wp-content/mu-plugins"
- "./src/sitename/client-mu-plugins:/var/www/html/wp-content/client-mu-plugins"
- "./src/sitename/images:/var/www/html/wp-content/images"
- "./src/sitename/languages:/var/www/html/wp-content/languages"
- "./src/sitename/plugins:/var/www/html/wp-content/plugins"
- "./src/sitename/private:/var/www/html/wp-content/private"
- "./src/sitename/themes:/var/www/html/wp-content/themes"
- "./src/sitename/vip-config:/var/www/html/wp-content/vip-config"
networks:
default:
external:
name: back
volumes:
wp: {}
So what changes do I make to get this run? I am not an expert and learning as I go. So I would appreciate help in figuring this out.
TIA