当我访问“ localhost / media / media.png”时,它返回404,但该文件已存在于文件夹中。我该如何解决这个问题?
我正在学习Python,我想用nginx,uwsgi和django建立一个网站,因此我阅读了https://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html?highlight=django上的官方教程来配置我的Web服务器。但是,当我“为您的网站配置nginx”时,我遇到了麻烦。该教程似乎在我的计算机上不起作用。
python版本:2.7.15rc1
nginx版本:1.14.0(Ubuntu)
django版本:1.11.20
# cs_community_site_nginx.conf
upstream django {
server 127.0.0.1:8001;
}
server {
listen 8000;
server_name 10.**.**.231; #
charset utf-8;
client_max_body_size 75M;
location /media {
alias /mnt/c/Users/duyu0/Documents/starfire/cs_community/cs_community_server/cs_community_site/media;
}
location /static {
alias /mnt/c/Users/duyu0/Documents/starfire/cs_community/cs_community_server/cs_community_site/static;
}
location / {
uwsgi_pass django;
include /mnt/c/Users/duyu0/Documents/starfire/cs_community/cs_community_server/cs_community_site/uwsgi_params;
}
}