-
Notifications
You must be signed in to change notification settings - Fork 330
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
Bad Gateway 502 #11
Comments
@phonic - Hard to say without getting some more information from you. Things to look at:
Feel free to post log output or other info that may help debug back to this thread.
|
Hey @mjstealey I did everything exactly as it was described from the instructions for localhost development (especially regarding .conf without SSL). Containers are running fine so far...
...and I can connect to the container via
After installing curl on the nginx container, the following command results with 502
Logically, I cannot connect to the wp instance from windows host as well A clean nginx container however (without WP/MySQL) results in a successful curl. I'm running on docker for windows. |
Thank you for the updated info.
It looks like the
It does look like Nginx is doing it's job in that you are getting a response served from Nginx.
Unfortunately I do not have access to a bare metal Windows box to test. I could spin up a Windows VM, but then would be using nested virtualization and may not be equivalent to what you are working with... |
In this case a bad gateway (502) error makes sense if the Wordpress container is unable to properly serve content. I still think the database may be the culprit in that Wordpress cannot interact with it because it's in a restarting loop/state and unable to serve the content that would normally be regulated by the database. I'm using macOS, so a sample http local deploy would be: git clone https://github.com/mjstealey/wordpress-nginx-docker.git
cd wordpress-nginx-docker
mkdir -p certs/ certs-data/ logs/nginx/ mysql/ wordpress/
cp nginx/wordpress.conf.example nginx/wordpress.conf
vi nginx/wordpress.conf ### update: server_name 127.0.0.1;
docker-compose up -d Running state: $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d1efa13b8fdb nginx:latest "nginx -g 'daemon of…" About a minute ago Up About a minute 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp nginx
d50a35575abc wordpress:php7.2-fpm "docker-entrypoint.s…" About a minute ago Up About a minute 9000/tcp wordpress
ba03d698e7b6 mariadb "docker-entrypoint.s…" About a minute ago Up About a minute 3306/tcp mysql A healthy $ docker logs mysql
Initializing database
PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:
'/usr/bin/mysqladmin' -u root password 'new-password'
'/usr/bin/mysqladmin' -u root -h password 'new-password'
Alternatively you can run:
'/usr/bin/mysql_secure_installation'
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.
Please report any problems at http://mariadb.org/jira
The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/
Database initialized
MySQL init process in progress...
2018-12-06 12:54:18 0 [Note] mysqld (mysqld 10.3.11-MariaDB-1:10.3.11+maria~bionic) starting as process 106 ...
2018-12-06 12:54:18 0 [Note] InnoDB: Using Linux native AIO
2018-12-06 12:54:18 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-12-06 12:54:18 0 [Note] InnoDB: Uses event mutexes
2018-12-06 12:54:18 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2018-12-06 12:54:18 0 [Note] InnoDB: Number of pools: 1
2018-12-06 12:54:18 0 [Note] InnoDB: Using SSE2 crc32 instructions
2018-12-06 12:54:18 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
2018-12-06 12:54:18 0 [Note] InnoDB: Completed initialization of buffer pool
2018-12-06 12:54:18 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-12-06 12:54:18 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2018-12-06 12:54:18 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-12-06 12:54:18 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
MySQL init process in progress...
2018-12-06 12:54:19 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-12-06 12:54:19 0 [Note] InnoDB: 10.3.11 started; log sequence number 1630824; transaction id 21
2018-12-06 12:54:19 0 [Note] Plugin 'FEEDBACK' is disabled.
2018-12-06 12:54:19 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2018-12-06 12:54:19 0 [Note] InnoDB: Buffer pool(s) load completed at 181206 12:54:19
2018-12-06 12:54:19 0 [Warning] 'user' entry 'root@ba03d698e7b6' ignored in --skip-name-resolve mode.
2018-12-06 12:54:19 0 [Warning] 'user' entry '@ba03d698e7b6' ignored in --skip-name-resolve mode.
2018-12-06 12:54:19 0 [Warning] 'proxies_priv' entry '@% root@ba03d698e7b6' ignored in --skip-name-resolve mode.
2018-12-06 12:54:19 0 [Note] Reading of all Master_info entries succeded
2018-12-06 12:54:19 0 [Note] Added new Master_info '' to hash table
2018-12-06 12:54:19 0 [Note] mysqld: ready for connections.
Version: '10.3.11-MariaDB-1:10.3.11+maria~bionic' socket: '/var/run/mysqld/mysqld.sock' port: 0 mariadb.org binary distribution
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
2018-12-06 12:54:35 10 [Warning] 'proxies_priv' entry '@% root@ba03d698e7b6' ignored in --skip-name-resolve mode.
2018-12-06 12:54:35 0 [Note] mysqld (initiated by: unknown): Normal shutdown
2018-12-06 12:54:35 0 [Note] Event Scheduler: Purging the queue. 0 events
2018-12-06 12:54:35 0 [Note] InnoDB: FTS optimize thread exiting.
2018-12-06 12:54:35 0 [Note] InnoDB: Starting shutdown...
2018-12-06 12:54:35 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2018-12-06 12:54:35 0 [Note] InnoDB: Buffer pool(s) dump completed at 181206 12:54:35
2018-12-06 12:54:36 0 [Note] InnoDB: Shutdown completed; log sequence number 1630833; transaction id 24
2018-12-06 12:54:36 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2018-12-06 12:54:37 0 [Note] mysqld: Shutdown complete
MySQL init process done. Ready for start up.
2018-12-06 12:54:37 0 [Note] mysqld (mysqld 10.3.11-MariaDB-1:10.3.11+maria~bionic) starting as process 1 ...
2018-12-06 12:54:37 0 [Note] InnoDB: Using Linux native AIO
2018-12-06 12:54:37 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-12-06 12:54:37 0 [Note] InnoDB: Uses event mutexes
2018-12-06 12:54:37 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2018-12-06 12:54:37 0 [Note] InnoDB: Number of pools: 1
2018-12-06 12:54:37 0 [Note] InnoDB: Using SSE2 crc32 instructions
2018-12-06 12:54:37 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
2018-12-06 12:54:37 0 [Note] InnoDB: Completed initialization of buffer pool
2018-12-06 12:54:37 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-12-06 12:54:37 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2018-12-06 12:54:37 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-12-06 12:54:37 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-12-06 12:54:38 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-12-06 12:54:38 0 [Note] InnoDB: 10.3.11 started; log sequence number 1630833; transaction id 21
2018-12-06 12:54:38 0 [Note] Plugin 'FEEDBACK' is disabled.
2018-12-06 12:54:38 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2018-12-06 12:54:38 0 [Note] Server socket created on IP: '::'.
2018-12-06 12:54:38 0 [Note] InnoDB: Buffer pool(s) load completed at 181206 12:54:38
2018-12-06 12:54:38 0 [Warning] 'proxies_priv' entry '@% root@ba03d698e7b6' ignored in --skip-name-resolve mode.
2018-12-06 12:54:38 0 [Note] Reading of all Master_info entries succeded
2018-12-06 12:54:38 0 [Note] Added new Master_info '' to hash table
2018-12-06 12:54:38 0 [Note] mysqld: ready for connections.
Version: '10.3.11-MariaDB-1:10.3.11+maria~bionic' socket: '/var/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution And finally a check of http://127.0.0.1 |
@mjstealey |
Solved the problem by removing the volume mount for mysql from docker-compose.
Otherwise I would get the following error log messages:
|
I am using a mac too and I ran into the same problem and I use a docker volume instead. It might have something to do with the file system. This approach might be easier to back up the database.
|
Did everything as it is described in the readme (for HTTP at 127.0.0.1), all containers are running fine, but I get a 502 as soon as I load the host-url via browser.
There are a few issues mentioned in the web like https://stackoverflow.com/questions/47429540/nginx-502-bad-gateway-within-docker-stack but none of the suggestions helped so far.
Any idea to solve that issue?
Best regards
The text was updated successfully, but these errors were encountered: