How to use nginx to serve static html for root and proxy everything else?
<p>The goal with this config is:</p>

<ol>
<li>Serve a plain html for the homepage to start the SPA, ex. <code>www.website.com</code>, <code>www.website.com/?foo=bar</code></li>
<li>Proxy to the Python REST API for everything that isn't caught by 1, ex. <code>www.website.com/foo</code>, <code>www.website.com/foo?bar=123</code></li>
</ol>

<p>The html file is at <code>/var/www/website.com/index.html</code></p>

<pre><code>server {
    listen 80;
    server_name website.com;
    return 301 $scheme://www.website.com$request_uri;
}

server {
    listen 80;
    server_name www.website.com;
    access_log off;

    location = / {
        root /var/www/website.com;
    }
    location / {
        proxy_pass http://127.0.0.1:8000;
    }
}
</code></pre>

<p>I'm seeing requests for <code>/index.html</code> on the Python side and failing there. If I delete the <code>location /</code>, then I see the "Welcome to nginx" page, so clearly the <code>location = /</code> is not working. What am I doing wrong?</p>