Score:0

Nginx configuration for docker web application

co flag

I am configuring Nginx (not in docker) to redirect a web service provider on localhost:9333 (which are placed in two docker containers). I could reach service through ssh, but when using the domain name on a web browser (I can ping with the domain name and it connects to the correct IP), the browser says "connection time out".

The nginx error.log says :"...[notice] 175385#175385: signal process started". I did not have a root file, I did only a proxy_pass.

Many thanks for help!

My nginx configuration is below: '''server {

listen 80;
listen [::]:80;

server_name xxxx.xxx.xx.xx;
server_name_in_redirect off;
client_max_body_size 200m;

error_page 502 503 504 = @maintenance;

listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate     /etc/nginx/ssl/my_server.crt;
ssl_certificate_key /etc/nginx/ssl/my.server.key;
ssl_prefer_server_ciphers on;


location / {
    proxy_http_version 1.1;

    proxy_set_header   Host              $host;
    proxy_set_header   X-Real-IP         $remote_addr;
    proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;
    proxy_set_header   X-Forwarded-Proto $scheme;

    proxy_pass http://127.0.0.1:9333/;
    sub_filter 'href="http://127.0.0.1:9333/'       'href="https://$host/';
}

location @maintenance {
    expires 0;
    add_header Pragma "no-cache";
    add_header Cache-Control "no-cache, no-store, must-revalidate";


    try_files $uri /50x.html =502;
}

} '''

Score:-2
in flag

Some info would help the distro you are using , if you have any error logs on the app container side, if you are using a cloud provider, etc.

I would suggest to check if the port is reachable with netcat or telnet and if not, to check security groups in the network connections (it can be set to allow only ssh) in the cloud`s provider console. Also, a good solution for you could be the Nginx Proxy manager container https://nginxproxymanager.com/. You can install it as a docker container and it is very easily configurable.

Wdann avatar
co flag
the app in the container is running fine since I could test it from ssh connection. No errors there in the container log either.
Wdann avatar
co flag
port 9333 is opening on the docker and the server. As I understand in Nginx configuration, I have redirected the port from 9333 to 443, and port 443 is open also on the server.
Wdann avatar
co flag
The question turned out to be ssl certificate error.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.