我用php開發了一個webdav協議的軟體phpdav
github地址:
https://github.com/xinghanking/phpdav
功能作用介紹:
https://zhuanlan.zhihu.com/p/64740062
安裝使用說明:
執行環境要求:
- php5.6 以上版本;
- nginx1.11.0以上版本(建議) ;
安裝步驟
- 從github上獲取phpdav程式碼,放置在你要做為phpdav程式碼的執行目錄內,如:/home/work/phpdav
-
修改conf/config.ini.php裡
$cloud_root = null;
為你要對映的目錄地址,
注意要給你php的執行使用者讀寫執行許可權
3 . 修改nginx配置,參考server { listen 443 ssl; server_name cloud.httpsdav.club; ssl_certificate ssl/phpdav.crt; ssl_certificate_key ssl/phpdav.key; ssl_session_timeout 5m; ssl_protocols SSLv3 TLSv1; ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP; access_log /home/phpdav/phpdav/logs/nginx/access.log main; charset utf-8; sendfile on; tcp_nodelay on; #關閉Nagle演算法,資料包直接傳送 client_max_body_size 0; #不限制body大小 client_body_in_file_only clean; # 連線斷開後清除儲存的臨時資料檔案 client_body_in_single_buffer on; location / { root /home/work/phpdav/interface; rewrite .* /index.php break; fastcgi_pass unix:/home/work/phpdav/server/run/php-cgi.sock; fastcgi_keep_conn on; fastcgi_limit_rate 0; fastcgi_request_buffering on; fastcgi_cache_revalidate on; fastcgi_pass_request_headers on; fastcgi_force_ranges on; fastcgi_connect_timeout 600s; fastcgi_read_timeout 600s; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param REQUEST_ID $request_id; fastcgi_param REQUEST_URI $request_uri; fastcgi_param REQUEST_BODY_FILE $request_body_file; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param REQUEST_SCHEME $scheme; fastcgi_param HTTPS $https if_not_empty; fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE phpdav-1.0; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; } }
-----
你可以直接將以上配置複製到你的nginx.conf的http配置項內,
只要修改裡面的 listen、server_name、 root 、 fastcgi_pass配置項
如果不開啟ssl ,可以刪除裡面的ssl相關配置項,如果要開啟ssl,請修改以上ssl的ssl_certificate、ssl_certificate_key配置項
如果你使用的nginx是低於nginx1.11.0版本,請將
fastcgi_param REQUEST_ID $request_id;
去掉,因為 $request_id 是在nginx1.11.0版本加入的
重啟nginx,然後就可以在你的本地電腦嘗試掛載使用了。