Reputation: 121
I am currently trying to deploy my app backend as Docker container with exposed ports to my root server.
If I am trying to curl the backend with http://example.com:3000
I get an timeout,
if I try it through nginx (view config underneath) I get an empty response (curl: (52) Empty reply from server
).
server {
listen 443 ssl;
server_name www.example.com example.com;
client_max_body_size 50m;
ssl_certificate ... # managed by Certbot
ssl_certificate_key ... # managed by Certbot
location /backend/ {
proxy_pass http://localhost:3000/;
}
}
However if I try to curl it from the server itself I have no problems.
Here is the relevant output of the docker ps
command:
COMMAND CREATED STATUS PORTS NAMES
"node dist/server.js" 9 minutes ago Up 8 minutes 0.0.0.0:9100->3000/tcp backend
Curl expected (works when running on root server):
$ curl http://localhost:3000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /</pre>
</body>
</html>
Upvotes: 0
Views: 65
Reputation: 121
The problem was iptables on my server. Some rules were deleted resulting in a violated Docker configuration.
A simple sudo service docker stop
was the trick.
Upvotes: 0
Reputation: 1566
You nginx is running ssl (port 443), so your curl should be:
curl -i https://example.com/backend/
.
dont specify any backend port.
Upvotes: 2