我有一个运行NGINX和其他运行gunicorn / Django的单独服务器,我设法根据Django文档的建议直接提供来自NGINX的静态文件,但我有一个问题,用户上传的文件,将上传到服务器已经gunicorn,而不是服务器有NGINX,因此用户无法找到他们的文件并浏览它们。
如何将文件从Django上传到另一台服务器?或者如何在上传到NGINX后从其他服务器传输文件?
注意:我没有CDN选项,我会从服务器上提供静态服务。
答案 0 :(得分:1)
You need to implement a solution for sharing files from one server to another. NFS is the standard in Unixes like Linux. An alternative is to use live mirroring, i.e. create a copy of the media files directory in the nginx server and keep it synchronized. There are probably many options for setting this up; I've successfully used lsyncd
.