{"id":292305,"date":"2019-07-19T15:00:34","date_gmt":"2019-07-19T15:00:34","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=292305"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=292305","title":{"rendered":"\u0420\u0430\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b\u044b \u0441 Google Drive \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c nginx"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<h3>\u041f\u0440\u0435\u0434\u044b\u0441\u0442\u043e\u0440\u0438\u044f<\/h3>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u0443\u0436 \u0441\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043c\u043d\u0435 \u0431\u044b\u043b\u043e \u0433\u0434\u0435-\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 1.5\u0442\u0431 \u0434\u0430\u043d\u043d\u044b\u0445, \u0434\u0430 \u0435\u0449\u0435 \u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u0445 \u043e\u0431\u044b\u0447\u043d\u044b\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u043f\u043e \u043f\u0440\u044f\u043c\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0435. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e \u0442\u0430\u043a\u0438\u0435 \u043e\u0431\u044a\u0435\u043c\u044b \u043f\u0430\u043c\u044f\u0442\u0438 \u0438\u0434\u0443\u0442 \u0443\u0436\u0435 \u043d\u0430 VDS, \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0430\u0440\u0435\u043d\u0434\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0432\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0431\u044e\u0434\u0436\u0435\u0442 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438\u0437 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u00ab\u043e\u0442 \u043d\u0435\u0447\u0435\u0433\u043e \u0434\u0435\u043b\u0430\u0442\u044c\u00bb, \u0430 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b VPS 400GB SSD, \u043a\u0443\u0434\u0430 \u043f\u0440\u0438 \u0432\u0441\u0435\u043c \u0436\u0435\u043b\u0430\u043d\u0438\u0438 1.5\u0442\u0431 \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a \u0431\u0435\u0437 loseless \u0441\u0436\u0430\u0442\u0438\u044f \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043d\u0435 \u0443\u0434\u0430\u0441\u0442\u0441\u044f. <\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u0418 \u0442\u0443\u0442 \u044f \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043b \u043f\u0440\u043e \u0442\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0441 \u0433\u0443\u0433\u043b-\u0434\u0438\u0441\u043a\u0430 \u0445\u043b\u0430\u043c, \u0432\u0440\u043e\u0434\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u044f\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 Windows XP, \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u0432\u0435\u0449\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u0447\u0443\u044e\u0442 \u0443 \u043c\u0435\u043d\u044f \u0441 \u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044f \u043d\u0430 \u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c \u0441 \u0442\u0435\u0445 \u043f\u043e\u0440, \u043a\u043e\u0433\u0434\u0430 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u0431\u044b\u043b \u043d\u0435 \u0442\u0430\u043a\u0438\u043c \u0431\u044b\u0441\u0442\u0440\u044b\u043c \u0438 \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u0431\u0435\u0437\u043b\u0438\u043c\u0438\u0442\u043d\u044b\u043c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0435 10-20 \u0432\u0435\u0440\u0441\u0438\u0439 virtual box \u0432\u0440\u044f\u0434 \u043b\u0438 \u0438\u043c\u0435\u043b\u0438 \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u0446\u0435\u043d\u043d\u043e\u0441\u0442\u044c, \u043a\u0440\u043e\u043c\u0435 \u043d\u043e\u0441\u0442\u0430\u043b\u044c\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0439), \u0442\u043e \u0432\u0441\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043e\u0447\u0435\u043d\u044c \u0434\u0430\u0436\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u0432\u043c\u0435\u0441\u0442\u0438\u0442\u044c\u0441\u044f. \u0421\u043a\u0430\u0437\u0430\u043d\u043e \u2014 \u0441\u0434\u0435\u043b\u0430\u043d\u043e. \u0418 \u0432\u043e\u0442, \u043f\u0440\u043e\u0431\u0438\u0432\u0430\u044f\u0441\u044c \u0447\u0435\u0440\u0435\u0437 \u043b\u0438\u043c\u0438\u0442 \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a api (\u043a\u0441\u0442\u0430\u0442\u0438, \u0442\u0435\u0445\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u0430 \u043a\u0432\u043e\u0442\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0437\u0430 100 \u0441\u0435\u043a\u0443\u043d\u0434 \u0434\u043e 10 000) \u0434\u0430\u043d\u043d\u044b\u0435 \u0440\u0435\u0437\u0432\u043e \u043f\u043e\u0442\u0435\u043a\u043b\u0438 \u0432 \u043c\u0435\u0441\u0442\u043e \u0441\u0432\u043e\u0435\u0439 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u0434\u0438\u0441\u043b\u043e\u043a\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u0432\u0440\u043e\u0434\u0435 \u0431\u044b \u0438 \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u043d\u0435\u0441\u0442\u0438 \u0434\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0414\u0430 \u0435\u0449\u0435 \u0438 \u0431\u0435\u0437 \u0432\u0441\u044f\u043a\u0438\u0445 \u0442\u0430\u043c \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b, \u0430 \u0447\u0442\u043e\u0431 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0436\u0430\u043b \u043a\u043d\u043e\u043f\u043e\u0447\u043a\u0443 \u00abDownload\u00bb \u0438 \u0441\u0442\u0430\u043b \u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432\u044b\u043c \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u0435\u043b\u0435\u043c \u0437\u0430\u0432\u0435\u0442\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430. <\/p>\n<p>  <\/p>\n<p>\u0422\u0443\u0442 \u044f, \u0435\u0439-\u0431\u043e\u0433\u0443, \u043f\u0443\u0441\u0442\u0438\u043b\u0441\u044f \u0432\u043e \u0432\u0441\u0435 \u0442\u044f\u0436\u043a\u0438\u0435. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u044d\u0442\u043e \u0431\u044b\u043b \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 AmPHP, \u043d\u043e \u043c\u0435\u043d\u044f \u043d\u0435 \u0443\u0441\u0442\u0440\u043e\u0438\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u0430\u044f \u0438\u043c \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 (\u0440\u0435\u0437\u043a\u0438\u0439 \u0441\u043a\u0430\u0447\u0435\u043a \u043d\u0430 \u0441\u0442\u0430\u0440\u0442\u0435 \u0434\u043e 100% \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u044f \u044f\u0434\u0440\u0430). \u041f\u043e\u0442\u043e\u043c \u0432 \u0434\u0435\u043b\u043e \u043f\u043e\u0448\u0435\u043b \u0432\u0440\u0430\u043f\u043f\u0435\u0440 curl \u0434\u043b\u044f ReactPHP, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043f\u043e\u043b\u043d\u0435 \u0432\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0441\u044f \u0432 \u043c\u043e\u0438 \u043f\u043e\u0436\u0435\u043b\u0430\u043d\u0438\u044f \u043f\u043e \u043f\u043e\u0435\u0434\u0430\u0435\u043c\u043e\u043c\u0443 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0442\u0430\u043a\u0442\u043e\u0432 CPU, \u043d\u043e \u0434\u0430\u0432\u0430\u043b \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u0442\u0430\u043a\u0443\u044e, \u043a\u0430\u043a \u043c\u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c (\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0432\u044b\u0437\u043e\u0432\u0430 curl_multi_select, \u043d\u043e \u0442\u043e\u0433\u0434\u0430 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0443\u044e \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0443 \u043f\u0440\u043e\u0436\u043e\u0440\u043b\u0438\u0432\u043e\u0441\u0442\u044c). \u041f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0434\u0430\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430 Rust, \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043e\u043d \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0440\u0435\u0437\u0432\u043e (\u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u0430\u0436\u0435 \u0442\u043e, \u0447\u0442\u043e \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u043b, \u0441 \u043c\u043e\u0438\u043c\u0438 \u0442\u043e \u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f\u043c\u0438), \u043d\u043e \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e, \u0434\u0430 \u0438 \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0431\u044b\u043b\u043e \u043a\u0430\u043a-\u0442\u043e \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u0432\u0441\u0435 \u044d\u0442\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043a\u0430\u043a-\u0442\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e \u0431\u0443\u0444\u0444\u0435\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043e\u0442\u0432\u0435\u0442, \u0430 \u043c\u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u043c\u043e\u043c\u0435\u043d\u0442 \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0430\u0441\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0444\u0430\u0439\u043b\u0430 \u0441 \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u044d\u0442\u043e \u043a\u043e\u0441\u043e-\u043a\u0440\u0438\u0432\u043e, \u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e. \u041f\u043e\u043a\u0430 \u043e\u0434\u043d\u0430\u0436\u0434\u044b \u043c\u043d\u0435 \u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u0430 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043f\u043e \u0441\u0432\u043e\u0435\u0439 \u0431\u0440\u0435\u0434\u043e\u0432\u043e\u0441\u0442\u0438 \u0438\u0434\u0435\u044f: nginx \u0432 \u0442\u0435\u043e\u0440\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 \u0442\u043e, \u0447\u0442\u043e \u044f \u0445\u043e\u0447\u0443, \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0440\u0435\u0437\u0432\u043e, \u0434\u0430 \u0435\u0449\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0441\u044f\u043a\u0438\u0435 \u0438\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c. \u041d\u0430\u0434\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u2014 \u0432\u0434\u0440\u0443\u0433 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f? \u0418 \u0441\u043f\u0443\u0441\u0442\u044f \u043f\u043e\u043b \u0434\u043d\u044f \u043d\u0430\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u044b\u0445 \u043f\u043e\u0438\u0441\u043a\u043e\u0432 \u0440\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0435 \u0443\u0436\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0441\u044f\u0446\u0435\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u043b\u043e \u0432\u0441\u0435\u043c \u043c\u043e\u0438\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c.<\/p>\n<p>  <\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c NGINX<\/h3>\n<p>  <\/p>\n<pre><code class=\"nginx\"># \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0430\u0445 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u043b\u043e\u043a\u0430\u0446\u0438\u044e. location ~* ^\/google_drive\/(.+)$ {      # \u0418 \u0437\u0430\u043a\u0440\u043e\u0435\u043c \u0435\u0451 \u043e\u0442 \u043f\u043e\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0433\u043b\u0430\u0437 (\u0440\u0443\u043a, \u043d\u043e\u0433 \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u0442\u0435\u043b\u0430).     internal;      # \u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0434\u043e \u0440\u0430\u0437\u0443\u043c\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0435\u043b\u043e\u0432 (\u044f \u0437\u0430 \u0440\u0430\u0432\u043d\u043e\u043f\u0440\u0430\u0432\u0438\u0435).     limit_rate 1m;      # \u0410 \u0447\u0442\u043e\u0431 nginx \u043c\u043e\u0433 \u043d\u0430\u0439\u0442\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 google drive \u0443\u043a\u0430\u0436\u0435\u043c \u0435\u043c\u0443 \u0430\u0434\u0440\u0435\u0441 \u0440\u0435\u0437\u043e\u043b\u0432\u0435\u0440\u0430.     resolver 8.8.8.8;      # C\u043e\u0431\u0435\u0440\u0435\u043c \u043f\u0443\u0442\u044c \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u0444\u0430\u0439\u043b\u0443 (\u043c\u044b \u043f\u043e\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c \u0435\u0433\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430\u043c\u0438).     set $download_url https:\/\/www.googleapis.com\/drive\/v3\/files\/$upstream_http_file_id?alt=media;      # \u0410 \u0442\u0430\u043a \u0436\u0435 Content-Disposition \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a, \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c \u043e\u043f\u044f\u0442\u044c \u0436\u0435 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430\u0445.     set $content_disposition 'attachment; filename=&quot;$upstream_http_filename&quot;';      # \u0417\u0430\u043f\u0440\u0435\u0442\u0438\u043c \u0431\u0443\u0444\u0444\u0435\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0434\u0438\u0441\u043a.     proxy_max_temp_file_size 0;      # \u0418, \u0447\u0442\u043e \u043d\u0435\u043c\u0430\u043b\u043e\u0432\u0430\u0436\u043d\u043e, \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0441 \u0442\u043e\u043a\u0435\u043d\u043e\u043c (\u043d\u0435 \u0437\u043d\u0430\u044e \u043f\u043e\u0447\u0435\u043c\u0443, \u043d\u043e \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430\u0445 \u0438\u0437 $http_upstream \u0442\u043e\u043a\u0435\u043d \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c. D\u0435\u0440\u043d\u0435\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u043d\u043e \u0441\u043a\u043e\u0440\u0435\u0439 \u0432\u0441\u0435\u0433\u043e \u0435\u0433\u043e \u0433\u0434\u0435-\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0433\u0443\u0433\u043b \u043e\u0442\u0434\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438).     proxy_set_header Authorization 'Bearer $1';      # \u0418 \u0432\u0441\u0435, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0433\u0443\u0433\u043b\u0443 \u043f\u043e \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u043e\u043c\u0443 \u043d\u0430\u043c\u0438 \u0430\u0434\u0440\u0435\u0441\u0443.     proxy_pass $download_url;      # \u0410 \u0447\u0442\u043e\u0431 \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u0440\u0438 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u043b\u043e\u0441\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a.     add_header Content-Disposition $content_disposition;      # \u041e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0443\u0431\u0438\u0440\u0430\u0442\u044c \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u043e\u0442 \u0433\u0443\u0433\u043b\u0430.     proxy_hide_header Content-Disposition;     proxy_hide_header Alt-Svc;     proxy_hide_header Expires;     proxy_hide_header Cache-Control;     proxy_hide_header Vary;     proxy_hide_header X-Goog-Hash;     proxy_hide_header X-GUploader-UploadID; } <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0440\u0430\u0442\u043a\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0431\u0435\u0437 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u043e\u043c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"nginx\">location ~* ^\/google_drive\/(.+)$ {     internal;     limit_rate 1m;     resolver 8.8.8.8;          set $download_url https:\/\/www.googleapis.com\/drive\/v3\/files\/$upstream_http_file_id?alt=media;     set $content_disposition 'attachment; filename=&quot;$upstream_http_filename&quot;';          proxy_max_temp_file_size 0;     proxy_set_header Authorization 'Bearer $1';     proxy_pass $download_url;          add_header Content-Disposition $content_disposition;          proxy_hide_header Content-Disposition;     proxy_hide_header Alt-Svc;     proxy_hide_header Expires;     proxy_hide_header Cache-Control;     proxy_hide_header Vary;     proxy_hide_header X-Goog-Hash;     proxy_hide_header X-GUploader-UploadID; }<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h3>\u041f\u0438\u0448\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u043c \u044d\u0442\u0438\u043c \u0441\u0447\u0430\u0441\u0442\u044c\u0435\u043c<\/h3>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430 PHP \u0438 \u043d\u0430\u0440\u043e\u0447\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0441 \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u043e\u043c \u043e\u0431\u0432\u0435\u0441\u0430. \u042f \u0434\u0443\u043c\u0430\u044e, \u043a\u0430\u0436\u0434\u044b\u0439, \u043a\u0442\u043e \u0438\u043c\u0435\u0435\u0442 \u043e\u043f\u044b\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043b\u044e\u0431\u044b\u043c \u0434\u0440\u0443\u0433\u0438\u043c \u044f\u0437\u044b\u043a\u043e\u043c \u0441\u043c\u043e\u0436\u0435\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u043e\u0434\u0435\u043b\u0438\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php  # \u0422\u043e\u043a\u0435\u043d \u0434\u043b\u044f Google Drive Api. define('TOKEN', '*****');  # ID \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0433\u0443\u0433\u043b \u0434\u0438\u0441\u043a\u0435 $fileId = 'abcdefghijklmnopqrstuvwxyz1234567890';  # \u041e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e, \u043d\u043e \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 - \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u0438 \u043d\u0435\u0442? http_response_code(204);  # \u0417\u0430\u0434\u0430\u0434\u0438\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a c ID \u0444\u0430\u0439\u043b\u0430 (\u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0430\u0445 nginx \u043c\u044b \u043f\u043e\u0442\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0435\u0433\u043e \u043a\u0430\u043a $upstream_http_file_id). header('File-Id: ' . $fileId); # \u0418 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u0444\u0430\u0439\u043b\u0430 (\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e $upstream_http_filename). header('Filename: ' . 'test.zip'); # \u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442. \u0410 \u0435\u0449\u0435 \u0432 \u0430\u0434\u0440\u0435\u0441\u0435 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c \u0442\u043e\u043a\u0435\u043d, \u0442\u043e\u0442 \u0441\u0430\u043c\u044b\u0439, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0437 $1 \u0432 nginx. header('X-Accel-Redirect: ' . rawurlencode('\/google_drive\/' . TOKEN));<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0418\u0442\u043e\u0433\u0438<\/h3>\n<p>  <\/p>\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u0434\u0430\u0447\u0443 \u0444\u0430\u0439\u043b\u043e\u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0441 \u043b\u044e\u0431\u043e\u0433\u043e \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430. \u0414\u0430 \u0445\u043e\u0442\u044c \u0438\u0437 telegram \u0438\u043b\u0438 VK, (\u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438, \u0447\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430 \u043d\u0435 \u043f\u0440\u0438\u0432\u044b\u0448\u0430\u0435\u0442 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0443 \u044d\u0442\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430). \u0423 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u0430 \u0438\u0434\u0435\u044f, \u043f\u043e\u0434\u043e\u0431\u043d\u0430\u044f <a href=\"https:\/\/habr.com\/ru\/company\/vds\/blog\/456290\/\">\u044d\u0442\u043e\u0439<\/a>, \u043d\u043e \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u0444\u0430\u0439\u043b\u044b \u0432\u043f\u043b\u043e\u0442\u044c \u0434\u043e 2\u0433\u0431, \u0430 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0438\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u043b\u044f \u0441\u043a\u043b\u0435\u0439\u043a\u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u0438\u0437 upstream \u044f \u043f\u043e\u043a\u0430 \u043d\u0435 \u043d\u0430\u0448\u0435\u043b, \u043f\u0438\u0441\u0430\u0442\u044c \u0436\u0435 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0432\u0440\u0430\u043f\u043f\u0435\u0440\u044b \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0435\u043e\u043f\u0440\u0430\u0432\u0434\u0430\u043d\u043d\u043e \u0442\u0440\u0443\u0434\u043e\u0437\u0430\u0442\u0440\u0430\u0442\u043d\u043e.<\/p>\n<p>  <\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u043c\u043e\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u0431\u044b\u043b\u0430 \u0445\u043e\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0438\u043b\u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u0430.<\/p>\n<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/460685\/\"> https:\/\/habr.com\/ru\/post\/460685\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<h3>\u041f\u0440\u0435\u0434\u044b\u0441\u0442\u043e\u0440\u0438\u044f<\/h3>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u0443\u0436 \u0441\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043c\u043d\u0435 \u0431\u044b\u043b\u043e \u0433\u0434\u0435-\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 1.5\u0442\u0431 \u0434\u0430\u043d\u043d\u044b\u0445, \u0434\u0430 \u0435\u0449\u0435 \u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u0445 \u043e\u0431\u044b\u0447\u043d\u044b\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u043f\u043e \u043f\u0440\u044f\u043c\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0435. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e \u0442\u0430\u043a\u0438\u0435 \u043e\u0431\u044a\u0435\u043c\u044b \u043f\u0430\u043c\u044f\u0442\u0438 \u0438\u0434\u0443\u0442 \u0443\u0436\u0435 \u043d\u0430 VDS, \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0430\u0440\u0435\u043d\u0434\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0432\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0431\u044e\u0434\u0436\u0435\u0442 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438\u0437 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u00ab\u043e\u0442 \u043d\u0435\u0447\u0435\u0433\u043e \u0434\u0435\u043b\u0430\u0442\u044c\u00bb, \u0430 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b VPS 400GB SSD, \u043a\u0443\u0434\u0430 \u043f\u0440\u0438 \u0432\u0441\u0435\u043c \u0436\u0435\u043b\u0430\u043d\u0438\u0438 1.5\u0442\u0431 \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a \u0431\u0435\u0437 loseless \u0441\u0436\u0430\u0442\u0438\u044f \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043d\u0435 \u0443\u0434\u0430\u0441\u0442\u0441\u044f. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-292305","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/292305","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=292305"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/292305\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=292305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=292305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=292305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}