【问题标题】:502 Bad Gateway on fresh api-platform docker-compose502 新 api 平台 docker-compose 上的网关错误
【发布时间】:2018-07-12 05:00:31
【问题描述】:

我在 Digital Ocean 上有 docker,但仍在尝试弄清楚如何使用 api-platform。所以我在 api-platform-2.3.0 默认页面上的 docker-compose up 80 端口正常加载,但是当我转到 8080 时,它显示网关错误。所以我查了一下是否一切正常,PHP似乎有问题。

CONTAINER ID        IMAGE                          COMMAND                  CREATED             STATUS                        PORTS                                                                    NAMES
0a0c4724d2d5        api_h2-proxy                   "nginx -g 'daemon of…"   18 minutes ago      Up 18 minutes                 0.0.0.0:443-444->443-444/tcp, 80/tcp, 0.0.0.0:8443-8444->8443-8444/tcp   api_h2-proxy_1
9958631ba1b8        quay.io/api-platform/varnish   "docker-varnish-entr…"   18 minutes ago      Up 18 minutes                 0.0.0.0:8081->80/tcp                                                     api_cache-proxy_1
68de4a5058dd        quay.io/api-platform/nginx     "nginx -g 'daemon of…"   18 minutes ago      Up 18 minutes                 0.0.0.0:8080->80/tcp                                                     api_api_1
f805ffdd804d        quay.io/api-platform/php       "docker-entrypoint p…"   18 minutes ago      Exited (126) 18 minutes ago                                                                            api_php_1
b020f888b81d        postgres:9.6-alpine            "docker-entrypoint.s…"   19 minutes ago      Up 19 minutes                 0.0.0.0:5432->5432/tcp                                                   api_db_1
1f86200d43bd        quay.io/api-platform/admin     "/bin/sh -c 'yarn st…"   19 minutes ago      Up 18 minutes                 0.0.0.0:81->3000/tcp                                                     api_admin_1
6986bf74b501        quay.io/api-platform/client    "/bin/sh -c 'yarn st…"   19 minutes ago      Up 18 minutes                 0.0.0.0:80->3000/tcp                                                     api_client_1

而且 docker-compose up 没有 -d 标志

root@restApi:/usr/api# docker-compose up
Creating api_admin_1       ... done
Creating api_php_1         ... done
Creating api_client_1      ... done
Creating api_api_1         ... done
Creating api_php_1         ...
Creating api_cache-proxy_1 ... done
Creating api_cache-proxy_1 ...
Creating api_h2-proxy_1    ... done
Attaching to api_db_1, api_php_1, api_api_1, api_cache-proxy_1, api_admin_1, api                                                                                  _client_1, api_h2-proxy_1
db_1           | LOG:  database system was shut down at 2018-07-12 04:32:08 UTC
db_1           | LOG:  MultiXact member wraparound protections are now enabled
db_1           | LOG:  database system is ready to accept connections
db_1           | LOG:  autovacuum launcher started
php_1          | Loading composer repositories with package information
php_1          | Installing dependencies (including require-dev) from lock file
php_1          | Nothing to install or update
php_1          | Generating autoload files
php_1          | Executing script cache:clear [OK]
php_1          | Executing script assets:install [OK]
php_1          | Waiting for Postgres to be ready...
php_1          |
php_1          | /usr/local/bin/docker-entrypoint: line 22: bin/console: Permiss                                                                                   ion denied
php_1          | db:5432 - accepting connections
api_php_1 exited with code 126
cache-proxy_1  | Debug: Platform: Linux,4.4.0-130-generic,x86_64,-junix,-smalloc                                                                                   ,-sdefault,-hcritbit
cache-proxy_1  | Debug: Child (18) Started
cache-proxy_1  | Info: Child (18) said Child starts
admin_1        | yarn run v1.5.1
admin_1        | $ react-scripts start
client_1       | yarn run v1.5.1
client_1       | $ react-scripts start
admin_1        | Starting the development server...
admin_1        |
client_1       | Starting the development server...
client_1       |
client_1       | Compiled successfully!
client_1       |
client_1       | You can now view client in the browser.
client_1       |
client_1       |   Local:            http://localhost:3000/
client_1       |   On Your Network:  http://172.18.0.6:3000/
client_1       |
client_1       | Note that the development build is not optimized.
client_1       | To create a production build, use yarn build.
client_1       |
admin_1        | Compiled successfully!
admin_1        |
admin_1        | You can now view admin in the browser.
admin_1        |
admin_1        |   Local:            http://localhost:3000/
admin_1        |   On Your Network:  http://172.18.0.3:3000/
admin_1        |
admin_1        | Note that the development build is not optimized.
admin_1        | To create a production build, use yarn build.
admin_1        |
api_1          | 2018/07/12 04:35:13 [error] 5#5: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 80.9                         5.103.67, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://172.18.0.3:9000", host: "restapi.my:8080"
api_1          | 80.95.103.67 - - [12/Jul/2018:04:35:13 +0000] "GET / HTTP/1.1" 502 575 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) App                         leWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36" "-"
api_1          | 80.95.103.67 - - [12/Jul/2018:04:35:13 +0000] "GET /favicon.ico HTTP/1.1" 200 32038 "http://restapi.my:8080/" "Mozilla/5.                         0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36" "-"
api_1          | 2018/07/12 04:35:21 [error] 5#5: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 80.9                         5.103.67, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://172.18.0.3:9000", host: "restapi.my:8080"
api_1          | 80.95.103.67 - - [12/Jul/2018:04:35:21 +0000] "GET / HTTP/1.1" 502 575 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) App                         leWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36" "-"
api_1          | 2018/07/12 04:36:01 [error] 5#5: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 80.9                         5.103.67, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://172.18.0.3:9000", host: "restapi.my:8080"
api_1          | 80.95.103.67 - - [12/Jul/2018:04:36:01 +0000] "GET / HTTP/1.1" 502 575 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) App                         leWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36" "-"

如您所见,php显示错误126,我猜这不正常,我有composer和php v. 7.0.3

感谢您的帮助。

附言我知道关于网关 503 的类似问题,但我的问题是使用干净的 Api-Platform 并且构建没有帮助。

【问题讨论】:

标签: php docker docker-compose api-platform.com bad-gateway


【解决方案1】:

问题是 api/bin/console 不能像@Kévin Dunglas 提到的那样执行。解决方案很简单,只需chmod 755 console。就是这样。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-02-03
    • 1970-01-01
    • 1970-01-01
    • 2021-03-22
    • 2018-12-18
    • 1970-01-01
    • 2019-07-07
    • 1970-01-01
    相关资源
    最近更新 更多