简体   繁体   English

从Web应用程序将文件上传到存储服务器

[英]Uploading files to a storage server from a web app

I have a webapp where by people are allowed to upload files, the webapp and upload form run on VPS1(24GB) I have another server called VPS2(1TB). 我有一个webapp,允许人们上载文件,该webapp和上载表单在VPS1(24GB)上运行,我还有另一个服务器,称为VPS2(1TB)。 I want user to use the webapp to upload files and for the files to be stored on the VPS2. 我希望用户使用webapp上传文件,并将文件存储在VPS2上。 How ever I'm not sure the best way to do this, would I upload the file to VPS1 and then transfer it to VPS2 via FTP(or other methods)? 如何不确定执行此操作的最佳方法,我将文件上传到VPS1,然后通过FTP(或其他方法)将其传输到VPS2吗? Or should I upload it directly to VPS2 using a post method on a webserver running on VPS2? 还是应该使用在VPS2上运行的Web服务器上的发布方法将其直接上传到VPS2? This has to be scalable, I will be adding more webservers in the future. 它必须具有可伸缩性,将来我将添加更多的Web服务器。

I had thoughts about putting all the storage VPS servers in an array in PHP an array and randomly selecting which one to post files to. 我曾考虑过将所有存储VPS服务器放置在PHP中的一个数组中,然后随机选择要向其中发布文件的服务器。 But I'm not sure, really lost and would like some advanced help. 但是我不确定,是否真的迷路了,想要一些高级帮助。

1.You can post your files to your vps2 php script and store files there, Thats a good option and for scalability you can choose which server to choose depending on nearest location of server for clients or randomly choose one. 1.您可以将文件发布到vps2 php脚本中,然后将文件存储在其中,这是一个不错的选择,为实现可伸缩性,您可以根据客户端的服务器位置选择要选择的服务器,也可以随机选择一个。 this is the best option i see here, And rest work is your database. 这是我在这里看到的最佳选择,其余的工作就是您的数据库。

2.Also you can backup a certain amount of files to your vps2 server using linux script when the disk is full using their local ip in case you have a local ip to share with other server. 2.如果磁盘已满,则可以使用本地脚本将一定数量的文件备份到vps2服务器,如果您有本地ip与其他服务器共享,则可以使用本地脚本将它们备份到vps2服务器。

But still first option is better, you can have different subdomains for the different web server like vps1.domain.com/file01 and vps2.domain.com/file02 and similarly other, and obviously script on different servers depends on sessions ,cookies , database. 但是第一个选择仍然更好,您可以为不同的Web服务器提供不同的子域,例如vps1.domain.com/file01和vps2.domain.com/file02以及类似的其他域,并且显然,不同服务器上的脚本取决于会话,cookie,数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM