I followed the discussion (link to thread below). regarding reverse-proxying a bokeh app server on Nginx and I got it to work. However, as I get the app link (http://sghrayeb.com:5006/allegation) to work it’s showing as “NOT SECURE”. How do I get it to secure?
/etc/nginx/sites-available/default
upstream flask_siti {
server 127.0.0.1:8118 fail_timeout=0;
}
upstream bokeh_siti {
server 127.0.0.1:5006 fail_timeout=0;
}
server {
root /var/www/wordpress/;
index index.php index.html index.htm index.nginx-debian.html;
server_name sghrayeb.com www.sghrayeb.com;
location / {
try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/xxx.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/xxxx.pem; # managed by Certbot
include /etc/letsencrypt/xxxxx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/xxxxx.pem; # managed by Certbot
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;
}
}
server {
if ($host = www.sghrayeb.com) {
return 301 http://$host$request_uri;
} # managed by Certbot
if ($host = sghrayeb.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen 80 default_server;
server_name sghrayeb.com www.sghrayeb.com;
return 404; # managed by Certbot
client_max_body_size 75M;
access_log /var/www/logs/nginx.access.log;
error_log /var/www/logs/nginx.log.error;
location /opt/webapps/bokehflask/ {
proxy_pass http://bokeh_siti;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host:$server_port;
proxy_buffering off;
}
location / {
# checks for static file, if not found proxy to the app
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
proxy_pass http://flask_siti;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host:$server_port;
proxy_buffering off;
}
}
here’s the command to run the app:
/opt/envs/virtual/bin/bokeh serve allegation.py --allow-websocket-origin=sghrayeb.com:5006 --allow-websocket-origin=www.sghrayeb.com:5006 --use-xheaders