當前位置:首頁 » 文件管理 » curlc上傳

curlc上傳

發布時間: 2025-07-04 09:59:35

A. 如何使用ftp用curl命令上傳文件

使用ftp用curl命令上傳文件方法:
第一種:

server端有現成的ftpserver:

上傳的option是 -T
比如我們向ftp傳一個文件: curl -T localfile -u name:passwd ftp://upload_site:port/path/
curl -T hadoop_oom.log -u user:1234567 ftp://1.1.1.1/

第二種:
nginx上傳: (需要加上--with-http_dav_mole模塊 )
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_mole --with-http_ssl_mole --with-http_dav_mole
make && make install

要創建上傳的臨時目錄
mkdir -p /dev/shm/client_body_temp
nginx http段加入:
client_body_temp_path /dev/shm/client_body_temp 1 2;
client_max_body_size 1024m; #這個根據實際的情況,如有大文件upload需要加大,不然nginx拋413 error

然後:
server
{
listen 80;
server_name 1.1.1.1;
index index.html index.htm index.php;
root html;
autoindex on;
dav_methods PUT; #這個是重點默認不允許PUT

測試:
curl -T hadoop_oom.log http://1.1.1.1/

安全注意事項:
一般需要單獨location一個目錄單獨做upload用。或者這個nginx只做upload上傳單一用途。
然後就是nginx allow了,一般機房都是內網打通的,只允許idc內網才能PUT。不然就能任意PUT到你的upload機器了。

熱點內容
java返回this 發布:2025-10-20 08:28:16 瀏覽:593
製作腳本網站 發布:2025-10-20 08:17:34 瀏覽:888
python中的init方法 發布:2025-10-20 08:17:33 瀏覽:581
圖案密碼什麼意思 發布:2025-10-20 08:16:56 瀏覽:765
怎麼清理微信視頻緩存 發布:2025-10-20 08:12:37 瀏覽:683
c語言編譯器怎麼看執行過程 發布:2025-10-20 08:00:32 瀏覽:1012
郵箱如何填寫發信伺服器 發布:2025-10-20 07:45:27 瀏覽:254
shell腳本入門案例 發布:2025-10-20 07:44:45 瀏覽:113
怎麼上傳照片瀏覽上傳 發布:2025-10-20 07:44:03 瀏覽:806
python股票數據獲取 發布:2025-10-20 07:39:44 瀏覽:712