Nginx не отрисовывает favicon и файлы статики недоступны. обслуживание с помощью Flask
У меня есть файлы в папке files и favicon.ico в папке static. Веб-страницы обслуживаются Nginx, favicon не виден и файлы недоступны. Я пробовал читать некоторые сообщения, но они не работают у меня. Вот конфигурация. Веб-страница работает, но иконка не отображается.
$ cat /etc/nginx/sites-enabled/my_app
server {
server_name www.mysite.com;
location /static/ {
# handle static files directly, without forwarding to the application
alias /home/ubuntu/mysite/app/static/;
expires 30d;
}
location = /_favicon.ico {
alias /home/ubuntu/mysite/app/static/favicon.ico;
}
location / {
# forward application requests to the gunicorn server
proxy_pass http://localhost:8000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/www.mysite.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/www.mysite.com/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
}
server {
if ($host = www.mysite.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name www.mysite.com;
return 404; # managed by Certbot
}
спасибо заранее