小编Dan*_*iel的帖子

如何从 Docker 中访问 nginx 服务器日志?

我有 Nginx 将请求从浏览器路由到 Express API 或我的 React 服务器,但是,在控制台中,我继续收到待处理的 xhr 请求,然后超时并出现 502 bad gateway 错误,这通常是由于 Nginx 无法将请求传递给“上游”,在本例中是我的 Express API,通常我能够检查文件/var/log/nginx/,但当所有这些都发生在 Docker 容器内时,我不确定如何执行此操作。

\n\n

我尝试过这种docker logs <container name/id>命令方法,但我得到了Error: No such container: <container-id>

\n\n

我在运行后从最后一行获取了容器 ID docker-compose up --build,它说Successfully built <container-id>

\n\n

我复制了该 ID 并docker logs <container-id>在 iTerm 中的第二个面板上运行。

\n\n

然后我做了一个docker ps并得到了这个输出:

\n\n
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES\nf37be54a9e60        complexly_api       "npm run dev"            43 minutes ago      Up 28 minutes                              complexly_api_1\n9b87bc0aa343 …
Run Code Online (Sandbox Code Playgroud)

docker docker-compose

5
推荐指数
1
解决办法
5万
查看次数

为什么我不能登录到这个服务器?

我正在尝试登录 centos 6.8 服务器,并且我有 IP 地址和正确的密码。它将私钥存储在我的 known_hosts 文件中,但后来我忘记了。我的同事可以从他的计算机登录,他在 id_rsa.pub 文件中拥有他发送给我的私钥。当我存储它时,我仍然无法登录。我删除了那个文件,但我仍然无法登录,我无法理解下面的错误日志,请帮助。

danales-MacBook-Pro:~ danale$ ssh -vvv <ip>
OpenSSH_7.3p1, LibreSSL 2.4.1
debug1: Reading configuration data /Users/danale/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug2: resolving "<ip>" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to <ip> [<ip>] port 22.
debug1: Connection established.
debug1: identity file /Users/danale/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/danale/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or …
Run Code Online (Sandbox Code Playgroud)

linux ssh private-key centos6

0
推荐指数
1
解决办法
1929
查看次数

标签 统计

centos6 ×1

docker ×1

docker-compose ×1

linux ×1

private-key ×1

ssh ×1