简体   繁体   English

新鲜的api平台docker-compose上的502错误网关

[英]502 Bad Gateway on fresh api-platform docker-compose

I have docker on Digital Ocean, and still trying to figure out how to work with api-platform. 我在Digital Ocean上有docker,但仍在尝试弄清楚如何使用api平台。 So I docker-compose up in api-platform-2.3.0 default page on port 80 loads up normally, but when I went to 8080, It shows bad gateway. 所以我在端口80的api-platform-2.3.0默认页面中docker-compose正常加载,但是当我转到8080时,它显示了错误的网关。 So I looked up if everything loads properly, and it seems that there's problem with PHP. 因此,我检查了是否一切正常加载,并且看来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

And docker-compose up without -d flag 和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" "-"

As you can see, the php shows error 126, which I guess is not normal, I have composer and php v. 7.0.3 如您所见,php显示错误126,我认为这是不正常的,我有composer和php v。7.0.3

Thanks for any help. 谢谢你的帮助。

ps I am aware of similar question on gateway 503 but mine is with clean Api-Platform and building up doesnt help. ps我知道网关503上有类似的问题,但是我的是干净的Api平台,建立起来没有帮助。

Problem was that api/bin/console was not executable as @Kévin Dunglas mentioned. 问题是api / bin / console无法执行,如@KévinDunglas所述。 Solution was easy, just chmod 755 console . 解决方法很简单,只需使用chmod 755 console And thats it. 就是这样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM