0

I've currently a discourse container running and working at port 80.

This is his nginx configuration:

server {
    listen 80; listen [::]:80;
    server_name discourse.name.com;  # <-- change this

    location / {
         proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock:;
         proxy_set_header Host $http_host;
         proxy_http_version 1.1;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Furthermore, I have a wordpress website and this is his docker-compose configuration:

version: '3.3'

services:
   db:
     image: mysql:5.7
     volumes:
       - db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: -
       MYSQL_DATABASE: wordpress
       MYSQL_USER: -
       MYSQL_PASSWORD: -

   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     ports:
       - "8000:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: -
       WORDPRESS_DB_PASSWORD: -
volumes:
    db_data:

However, I can see anything on port 8000. I would like to have the wordpress site running at 8000 in order to redirect nginx to it with 80 port when I access "name.com" (name is not the real domain name).

Filnik
  • 352
  • 1
  • 12
  • 33
  • Make sure the containers are on the same bridge network. When you `docker run ...` the `default` is being used. When you `docker-compose up ...` a `custom` bridge is being created. – tgogos Nov 14 '18 at 15:05
  • how can I do that? :( thanks! @tgogos – Filnik Nov 14 '18 at 15:05
  • An approach would be to (1) create a network, (2) run your `nginx` container and attach it to this network with the `--net` flag, (3) update your `docker-compose.yml` file accordingly in order to [use a pre-existing network](https://docs.docker.com/compose/networking/#use-a-pre-existing-network) – tgogos Nov 14 '18 at 15:12
  • done... no changes there :( I see that nginx is like preventing me to access the wordpress website. Dunno why is hiding it – Filnik Nov 14 '18 at 16:27

0 Answers0