在nginx中,我的Django应用程序具有此配置。 但是,我的媒体文件不起作用。
server {
listen 8000;
server_name 104.155.134.205;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/fractaluser/taswira;
}
location /media/ {
root /home/fractaluser/taswira;
}
location / {
include proxy_params;
proxy_pass http://unix:/home/fractaluser/taswira/taswira.sock;
}
}
fractaluser@taswira-instance-1:~/taswira$ ls
README.md dataset mail-template.html member profiling-requirements.txt requirements.txt scheduler.py taswira.sock
amchart.notes env manage.py pdfs registration.html reset.html settings test.py
approved.html invite.html media profiling rejected.html rough.py subscribe.html user
fractaluser@taswira-instance-1:~/taswira$
我的媒体文件夹位于我的根目录中。
它可以更早地工作,但是在将域名添加到api.taswira.ai之后,媒体文件未加载。 在nginx中说找不到。
请看看