我使用 nginx 作为几个 Flask 应用程序的代理,使用 uwsgi 作为中间件。这是我的测试应用程序的 nginx 配置。
server {
listen 80;
server_name test.myapp.com www.test.myapp.com;
charset utf-8;
client_max_body_size 250M;
location / { try_files $uri @testapp; }
location @testapp {
include uwsgi_params;
uwsgi_pass unix:/tmp/testapp_uwsgi.sock;
}
location /forecaster/components/ {
alias /opt/test/client/app/components/;
}
Run Code Online (Sandbox Code Playgroud)
}
Run Code Online (Sandbox Code Playgroud)
我很确定 nginx 实际上并没有为静态文件提供服务,即使我注释掉了该location
块,文件也是从某些东西中获取的。我在 nginx 日志中看到了 200 个,在 uWsgi 日志中也看到了 200 个。你怎么知道哪个是服务静态文件的?我想烧瓶应用程序也可以为他们服务?
/opt/test/client/app/components/ 肯定存在,并且对其他人可读。有什么方法可以强制 uwsgi 不处理这些请求?