Comments (9)
Setting these variables fixed my previous issue:
ENV PHP_FPM_UPSTREAM="wordpress:9000"
ENV NGINX_PROXY_UPSTREAM="wordpress:9000"
ENV REDIS_UPSTREAM="redis:6379
but now when I run curl https://localhost --insecure
, I get this instead of wordpress:
<html><head><meta http-equiv="refresh" content="1">
</head><body><br/><br/><h1>HTTP 502 / No backend servers found at the moment</h1>
<h3>Refreshing automatically to reconnect to backend...</h3></body>
from nginx.
Normally a 502 error will occur because of different startup times between your instances. In this case, it is likely PHP and Wordpress were not available for Nginx to connect. It might take 20-30 seconds.
from nginx.
That's unlikely. Here's the output of docker ps
:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
509706a826b3 proxy_nginx "/docker-entrypoint.…" 6 minutes ago Up 6 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp nginx
492bb39a3bc2 mysql:5.7 "docker-entrypoint.s…" 6 minutes ago Up 6 minutes 3306/tcp, 33060/tcp mysql
c9e4aa077510 redis:alpine "docker-entrypoint.s…" 6 minutes ago Up 6 minutes 6379/tcp redis
2d9ed52a0572 wordpress:php7.1-fpm-alpine "docker-entrypoint.s…" About an hour ago Up About an hour 9000/tcp wordpress
Thanks for taking the time to open source this image! It's a great starting point with good defaults. 🍻
from nginx.
can you do docker logs for the wordpress container? Would be curious what it says. Also, can you share your docker compose yml?
from nginx.
First Dockerfile:
FROM wordpress:php7.1-fpm-alpine
RUN mkdir -p /var/www/html/wp-content/themes/demo/
COPY . /var/www/html/wp-content/themes/demo/
First docker-compose.yml:
version: '3.7'
services:
wordpress:
build: .
container_name: wordpress
restart: unless-stopped
volumes:
- thilak_root:/var/www/html
networks:
- proxy
environment:
WORDPRESS_DB_HOST: mysql
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DB_PASSWORD: 'super_secret'
networks:
proxy:
external: true
volumes:
wordpress_root:
external: true
Second Dockerfile:
FROM openbridge/nginx:latest
ENV NGINX_CONFIG=php
ENV NGINX_DEV_INSTALL=true
ENV PHP_FPM_UPSTREAM="wordpress:9000"
ENV NGINX_PROXY_UPSTREAM="wordpress:9000"
ENV REDIS_UPSTREAM="redis:6379"
ENV NGINX_SERVER_NAME=localhost
Second docker-compose.yml:
version: '3.7'
services:
nginx:
build: .
restart: unless-stopped
container_name: nginx
ulimits:
nproc: 65535
nofile:
soft: 49999
hard: 99999
tmpfs: /var/cache
tty: true
volumes:
- type: volume
source: wordpress_root
target: /usr/share/nginx/html
volume:
nocopy: true
logging:
driver: "json-file"
options:
max-size: "1k"
max-file: "3"
networks:
- proxy
ports:
- 80:80
- 443:443
mysql:
image: mysql:5.7
container_name: mysql
restart: unless-stopped
networks:
- proxy
environment:
MYSQL_ROOT_PASSWORD: 'super_secret'
volumes:
- mysql:/var/lib/mysql
redis:
image: redis:alpine
container_name: redis
networks:
- proxy
restart: unless-stopped
networks:
proxy:
external: true
volumes:
wordpress_root:
external: true
mysql:
external: true
Output of docker logs
of WordPress container
WordPress not found in /var/www/html - copying now...
WARNING: /var/www/html is not empty! (copying anyhow)
Complete! WordPress has been successfully copied to /var/www/html
[28-Jan-2019 18:27:59] NOTICE: fpm is running, pid 1
[28-Jan-2019 18:27:59] NOTICE: ready to handle connections
from nginx.
I don't see your wordpress container in the compose file. I don't think it is going to understand wordpress:9000
as a reference if you are not doing this.
from nginx.
Are you sure about that? My previous setup involved wordpress/php7.1-apache
with nginx:latest
on the front and I was able to proxy wordpress:80
just fine, and WordPress container was able to connect with MySQL.
My understanding was containers that share the same network (proxy
in my case) can talk to one another.
from nginx.
@tspicer To test your hypothesis, I moved wordpress:php7.1-fpm-alpine
image into the docker compose file, but I still have the same issue
curl https://localhost --insecure
# Output:
<html><head><meta http-equiv="refresh" content="1">
</head><body><br/><br/><h1>HTTP 502 / No backend servers found at the moment</h1>
<h3>Refreshing automatically to reconnect to backend...</h3></body>
You can clone this repo and run start.sh
(this shell script creates the external volumes).
from nginx.
When I SSH into the docker openbridge/nginx:latest
container, I'm able to ping wordpress
hostname successfully.
from nginx.
Related Issues (20)
- WP configuration HOT 9
- ngx_http_geoip_module.so HOT 10
- 502 Bad Gateway (ob_php-fpm/wordpress) HOT 3
- nginx cache logged users HOT 11
- DockerFile error Step 6/16 : COPY conf/ /conf HOT 1
- "variables_hash_max_size" directive is duplicate HOT 11
- I want to use this dockers for django. HOT 1
- multiple site setting at nginx env HOT 2
- how can I use the docker image of "openbridge/ob_php-fpm" HOT 1
- Nginx not found HOT 9
- monit always failed at 8080 port check HOT 3
- Help with a version to use with Prestashop 1.7+ HOT 2
- Nginx Pagespeed module? HOT 1
- Unable to serve static files proxying HTTPS
- Directives from the nocache.map file do not work. HOT 2
- failed to read dockerfile: open Dockerfile: no such file or directory
- ERROR: Couldn't find env file: /Github/ob_nginx/env/html.env
- PHP8 support? HOT 1
- What was the reasoning for adding $msec to WP CSS/JS files?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nginx.