Tôi mới dùng máy chủ nginx. Tôi đã cố gắng đặt url mới "/ images /" để phân phát hình ảnh. Tôi đã chỉnh sửa tệp bi.site trong thư mục hỗ trợ trang web.Thư mục gốc hiển thị 404 trong nginx
server {
listen *:80;
access_log /var/log/myproject/access_log;
location/{
proxy_pass http://127.0.0.1:5000/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /images/ {
root /www/myproject/files_storage;
}
}
Và trong/www/myproject/files_storage vị trí, tôi đặt tệp temp.txt.
Khi tôi đặt http://www.main_url/images/temp.txt
, nó không hiển thị 404. Tôi đang làm gì sai? Tôi đã bỏ lỡ một cái gì đó quan trọng?