I just cannot get my application to run on https/ssl. I'm running my app with gunicorn, with the following command: gunicorn --worker-class eventlet --bind 0.0.0.0:5000 wsgi:app
It works fine on http, but I don't know how to make my server (with port 5000) to run with https/ssl.
My Nginx sites-available file:
upstream websocket1 {
server 127.0.0.1:5000;
}
server {
listen 80;
server_name cervinare.se www.cervinare.se;
listen [::]:80;
root /var/www/cervinare.se/html;
index index.html index.htm index.nginx-debian.html;
location / {
add_header Access-Control-Allow-Origin *;
try_files $uri /index.html;
}
location /api/ {
# include uwsgi_params;
# uwsgi_pass unix:/root/cervinare-2/backend/cervinare.se.sock;
proxy_pass http://0.0.0.0:5000/api;
}
location /socket.io/ {
include proxy_params;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'Upgrade';
proxy_pass http://websocket1/socket.io;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/cervinare.se/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/cervinare.se/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
}
It's the /api/ route that I want to be https.
Thanks in advance! :)
/api/
proxy_pass
should beproxy_pass http://127.0.0.1:5000/api;