我正在尝试为用户提供一些文件,并且我有Nginx用于查找文件的路径。问题是Nginx找不到指定的文件,所以我查看了错误日志。
2019/01/29 00:16:23 [错误] 30539#30539:* 277 open() “ /usr/share/nginx/htmlhome/django/copypaste/cleanup/var/media/admin/output/123.txt” 失败(2:没有此类文件或目录),客户端:127.0.0.1,服务器: 127.0.0.1,请求:“ GET / dashboard / download / task / 11 / HTTP / 1.1”,上游: “ uwsgi:// unix:///home/django/copypaste/cleanup/usegolem.sock”,主持人: “ 127.0.0.1:8000”,引荐来源网址:“ http://127.0.0.1:8000/dashboard”
看起来Nginx将路径/usr/share/nginx/html
添加到了我指定的路径上。我该如何删除?
这是我的服务器配置
# mysite_nginx.conf
# the upstream component nginx needs to connect to
upstream django {
server unix:///home/django/copypaste/cleanup/usegolem.sock; # for a file socket
# server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}
# configuration of the server
server {
# the port your site will be served on
listen 8000;
# the domain name it will serve for
server_name 127.0.0.1; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 250M; # adjust to taste
# Django media
location /media {
alias /home/django/copypaste/cleanup/var/media; # your Django project's media files - amend as required
}
location /static {
alias /home/django/copypaste/cleanup/static/static; # your Django project's static files - amend as required
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include /home/django/copypaste/cleanup/uwsgi_params; # the uwsgi_params file you installed
}
location /protected {
internal; # only the apache instance can access this url directly
alias /home/django/copypaste/cleanup/var/media;
}
}