[英]Problem express with nginx reverse proxy, not send static file
Nginx when I ask for my static file always returns 404, but with I understand what the reason is, if I'm wrong something that surely is so you can explain to me why it was wrong: here are the configuration files: Nginx 当我询问我的 static 文件时总是返回 404,但我明白原因是什么,如果我错了,那肯定是这样,你可以向我解释为什么错了:这里是配置文件:
default.conf默认.conf
upstream apps {
server webapi:9000 fail_timeout=10s max_fails=5;
}
server {
listen 80 default_server;
large_client_header_buffers 4 16k;
location @apphost {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://apps;
proxy_redirect off;
}
}
Following two articles helped me:以下两篇文章帮助了我:
.Net Core 3.0 Nginx not serving static files .Net Core 3.0 Nginx 不提供 static 文件
https://docs.nginx.com/nginx/admin-guide/web-server/serving-static-content/ https://docs.nginx.com/nginx/admin-guide/web-server/serving-static-content/
I added following two blocks under my server block:我在我的服务器块下添加了以下两个块:
location /assets/ {
}
location ~ \.(css|js|lib|png) {
root /var/apps/dev/myapp/wwwroot;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.