Request for nginx config for Flask + Bokeh server

@_jm thank you for your detailed response with sample code. Appreciate it. I implemented everything in your note except for worker_processes, events and http as i got some syntax error thrown when i pasted it as-is in a conf file at /etc/nginx/conf.d/. However, i didn’t get the actual plot rendered. Maybe i did something else wrong.

Here is the screenshot:

I searched for a sample embed.html and used (see below), maybe it needs correction?

<!doctype html>

<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Embedding a Bokeh Server With {{ framework }}</title>
</head>

<body>
  <div>
    This Bokeh app below served by a Bokeh server that has been embedded
    in another web app framework. For more information see the section
    <a  target="_blank" href="https://docs.bokeh.org/en/latest/docs/user_guide/server.html#embedding-bokeh-server-as-a-library">Embedding Bokeh Server as a Library</a>
    in the User's Guide.
  </div>
  {{ script|safe }}
</body>
</html>

Someone suggested a modification as below, but didn’t make any difference

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Embedding a Bokeh Server With {{ framework }}</title>
  <link rel="stylesheet" href={​​​​​​{​​​​​​cdn_css | safe}​​​​​​}​​​​​​ type="text/css" />

         <script type="text/javascript" src={​​​​​​{​​​​​​cdn_js | safe}​​​​​​}​​​​​​></script>
</head>

<body>
  <div>
    This Bokeh app below served by a Bokeh server. For more information see
    <a  target="_blank" href="https://docs.bokeh.org/en/latest/docs/user_guide/server.html#embedding-bokeh-server-as-a-library">Embedding Bokeh Server as a Library</a>
    in the User's Guide.
  </div>
  {{ script|safe }}
</body>
</html>

Here is the nginx conf i have:

server {
        listen       80;
        server_name  ##.##.##.##;

        location / {
            proxy_pass http://127.0.0.1:5100;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_http_version 1.1;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $host:$server_port;
            proxy_buffering off;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

In the gunicorn_config.py i set nginx address to my public ip and port to 80 (and after running gunicorn and restarting nginx, went to my browser and typed my.pub.lic.ip which showed the error page) I didnt make any changes to your flask_gunicorn_embed.py

Any ideas on what could be going wrong? Would be great if you can share a suitable embed.html.