Uwsgi_pass not working after certbot success (docker-compose)

Sorry if I answer any of the questions below inaccurately...

My domain is: geodraw.org

I ran this command: certbot --nginx

It produced this output: Success

My web server is (include version): not sure

The operating system my web server runs on is (include version): Ubuntu 16.04.7 LTS but I am running nginx in the container nginx:1.20-alpine

My hosting provider, if applicable, is: Google Cloud Platform

I can login to a root shell on my machine (yes or no, or I don't know): yes

I'm using a control panel to manage my site (no, or provide the name and version of the control panel): no

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): certbot 1.11.0

Before using certbot everything was working well. Now, connections are refused. After using certbot it seems that user requests are not being passed by uwsgi_pass to the other docker containers. I am pretty sure about this because I can see that I'm reaching nginx with requests but not the other containers from the docker-compose logs. I've pasted relevant files down below. THANK YOU <3 :grinning: :smiley: :robot:


server {
server_name geodraw.org www.geodraw.org;

location / {
    include uwsgi_params;
    uwsgi_pass front:8081;

location /api {
    include uwsgi_params;
    uwsgi_pass flask:8080;

listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/geodraw.org/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/geodraw.org/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

server {
if ($host = www.geodraw.org) {
return 301 https://$host$request_uri;
} # managed by Certbot

if ($host = geodraw.org) {
    return 301 https://$host$request_uri;
} # managed by Certbot

server_name geodraw.org www.geodraw.org;

listen 80;
listen [::]:80;
return 404; # managed by Certbot


cat /etc/nginx/nginx.conf

user nginx;
worker_processes auto;

error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;

events {
worker_connections 1024;

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';

access_log  /var/log/nginx/access.log  main;

sendfile        on;
#tcp_nopush     on;

keepalive_timeout  65;

#gzip  on;

include /etc/nginx/conf.d/*.conf;



version: "3.7"


    image: flask
    build: ./flask
    container_name: flask
    restart: always
        - APP_NAME=MyFlaskApp
        - 8080

    image: front
    build: ./front
    container_name: front
    restart: always
        - APP_NAME=MyFlaskApp
        - 8081

    image: nginx
    build: ./nginx
    container_name: nginx
    restart: always
        - "80:80"

    image: tfserving
    build: ./tfserving
    container_name: tfserving
    restart: always
        - 8501

HTTPS runs on a different network port to insecure HTTP.

You need to expose both port 80 (which you already have) and port 443, in order for all of this to work.

You will need to make this change for the nginx service in your docker-compose file:

That should be:

        - "80:80"
        - "443:443"

Thank you so much! I knew I had to be overlooking something simple! :orange_heart: :yellow_heart: :green_heart: :blue_heart: :purple_heart: :brown_heart: :black_heart: :white_heart: :heart:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.