Confirm if application is using nginx to serve static files
First, requests to port 8000
completely bypass nginx, so nothing strange here. You should go to localhost
without port number.
Second, you have to symlink this config to /etc/nginx/sites-enabled
and reload nginx.
Third, your static location is wrong. You have location
without trailing slash and alias
with one. They should always be with or without trailing slash simultaneously. And in this case it's even better to have root
directive.
server { root /home/www/flask_project; index index.html; location / { proxy_pass http://localhost:8000/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } location /static/ { # empty. Will serve static files from ROOT/static. }}
You should make request directly http://localhost:8000/static/index.html then you will see response.
But if you want to see on index.html
by default, you should have something like in conf:
location /static { alias /home/www/flask_project/static/; try_files $uri $uri/index.html index.html;}