Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem Nginx to Apache container #234

Closed
fgirardey opened this issue Sep 11, 2015 · 9 comments
Closed

Problem Nginx to Apache container #234

fgirardey opened this issue Sep 11, 2015 · 9 comments

Comments

@fgirardey
Copy link

Hi,

I'm not sure if it's a bug but i've got a docker-compose.yml file with the following content :

data:
  image: groupeforum/data

proxy:
  image: jwilder/nginx-proxy
  hostname: local.dev
  ports:
    - "80:80"
    - "443:443"

wordpress:
  image: groupeforum/wordpress
  links:
    - db:mysql
    - maildev:maildev
  volumes:
    - ./app:/var/www/html
  environment:
    VIRTUAL_HOST: local.dev
    APP_ENV: local
  restart: always

db:
  image: mysql
  environment:
    MYSQL_ROOT_PASSWORD: root
    MYSQL_DATABASE: database
    MYSQL_USER: user
    MYSQL_PASSWORD: password
  volumes_from:
    - data
  ports:
    - "3306:3306"
  restart: always

maildev:
  image: djfarrelly/maildev
  ports:
    - "1080:80"
    - "1025:25"

To be short, the groupeforum/wordpress image is a simple PHP/Apache installation for my WordPress Workflow.

So i can't understand why when i type http://local.dev i only got the "Welcome to nginx!" web page.

Do i need to use Nginx on my groupeforum/wordpress image ?

@jmparra
Copy link

jmparra commented Sep 11, 2015

i think you need expose port 80 in wordpress

@idef1x
Copy link

idef1x commented Sep 11, 2015

Setting the hostname on the proxy to local.dev AND as VIRTUAL_HOST to wordpress doesn't seem right to me.. I can imagine that nginx will forward requests for local.dev to itself..hence the welcome to nginx result...
And as jmparra mentioned: the Dockerfile of the wordpress image you're using doesn't contain an EXPOSE entry..

@fgirardey
Copy link
Author

I need to EXPOSE 80 Even if the FROM image does it already ?

@thomasleveil
Copy link
Contributor

try this:

data:
  image: groupeforum/data

proxy:
  image: jwilder/nginx-proxy
  volumes:
    - /var/run/docker.sock:/tmp/docker.sock:ro
  ports:
    - "80:80"
    - "443:443"

wordpress:
  image: groupeforum/wordpress
  links:
    - db:mysql
    - maildev:maildev
  volumes:
    - ./app:/var/www/html
  environment:
    VIRTUAL_HOST: local.dev
    APP_ENV: local
  restart: always
  expose:
    - "80"

db:
  image: mysql
  environment:
    MYSQL_ROOT_PASSWORD: root
    MYSQL_DATABASE: database
    MYSQL_USER: user
    MYSQL_PASSWORD: password
  volumes_from:
    - data
  ports:
    - "3306:3306"
  restart: always

maildev:
  image: djfarrelly/maildev
  ports:
    - "1080:80"
    - "1025:25"

@md5
Copy link
Contributor

md5 commented Sep 11, 2015

I need to EXPOSE 80 Even if the FROM image does it already ?

@fgirardey No, that should mean it's already exposed. There's something else going on here.

The Nginx welcome page generally only shows when the config file generated by nginx-proxy is broken in some way.

@md5
Copy link
Contributor

md5 commented Sep 11, 2015

@fgirardey I notice you aren't mounting the docker.sock into your nginx-proxy container. That's likely the source of your problem. If you look at the output of docker logs, I expect you'll see an error message from docker-gen.

@fgirardey
Copy link
Author

Ah ? So i have to mount a volume like that : ?

data:
  image: groupeforum/data

proxy:
  image: jwilder/nginx-proxy
  ports:
    - "80:80"
    - "443:443"
  volumes:
    - /var/run/docker.sock:/tmp/docker.sock:ro

wordpress:
  image: groupeforum/wordpress
  links:
    - db:mysql
    - maildev:maildev
  volumes:
    - ./app:/var/www/html
  environment:
    VIRTUAL_HOST: local.dev
    APP_ENV: local
  restart: always
  expose:
    - "80"

db:
  image: mysql
  environment:
    MYSQL_ROOT_PASSWORD: root
    MYSQL_DATABASE: database
    MYSQL_USER: user
    MYSQL_PASSWORD: password
  volumes_from:
    - data
  ports:
    - "3306:3306"
  restart: always

maildev:
  image: djfarrelly/maildev
  ports:
    - "1080:80"
    - "1025:25"

@md5
Copy link
Contributor

md5 commented Sep 11, 2015

The equivalent of those settings are what's needed on the command line, but there have been reports of problems with docker-compose mounting individual files correctly. Here's a relevant issue: docker/compose#424

@tkw1536
Copy link
Collaborator

tkw1536 commented Apr 10, 2022

Related docker-composed issue is closed, closing.

@tkw1536 tkw1536 closed this as completed Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants