若是你是一個網站服務器管理員或者web應用開發者、我的站長,你平時管理你的開發機或者網站服務器,上傳網站代碼或者各種應用文件,可能都是使用諸如cuteftp、xftp、winscp之類的工具軟件這樣作:php
左邊本地文件目錄視圖,右邊遠程服務器文件目錄視圖,而後各類拖拽操做。如今我來提供一種不管你本地電腦用的是windows仍是mac本都不須要另行安裝任何第三方工具軟件就能夠管理遠程服務器文件目錄的方式——把你要管理的遠程服務器文件目錄掛載成一個本地電腦硬盤。node
一個demo用來講明一切nginx
網絡訪問地址:https://cloud.httpsdav.clubgit
登陸用戶名:liuzhonglianggithub
密碼: liuzongliangweb
我如今用https://cloud.httpsdav.club這個網絡地址映射的是我一個vps網絡服務器的/home/phpdav/mycloud的目錄。windows
掛載成爲本地windows電腦的步驟以下:bash
一、點擊桌面「這臺電腦」(win7下應爲「計算機」)服務器
二、點擊計算機裏的「映射網絡驅動器」網絡
3. 彈出窗口內文件夾輸入框內填寫映射的網絡地址
四、點擊完成,彈出窗口內輸入用戶名和密碼
點擊肯定後,看到是否是個人電腦裏多出了一塊硬盤?
那服務器端如何配置的?
能夠從github上得到我用php開發的代碼
https://github.com/xinghanking/phpdav
修改 conf/config.ini.php 文件
$cloud_root = null;
爲你要映射的服務器目錄地址,注意要給你的php-fpm的執行用戶讀寫執行權限
例如你的php-fpm的執行用戶爲phpdav用戶組phpdav, 你映射的目錄地址爲/home/phpdav/mycloud
建議你這樣作:
chown -R phpdav:phpdav /home/phpdav/mycloud chmod -R 700 /home/phpdav/mycloud
nginx配置參考
server { listen 443 ssl; server_name cloud.httpsdav.club 167.179.111.224 2001:19f0:7001:12e9:5400:2ff:fe02:a361; 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; client_max_body_size 0; client_body_in_file_only clean; client_body_in_single_buffer on; auth_basic "login test"; auth_basic_user_file passwd.txt; location / { root /home/phpdav/phpdav/interface; rewrite .* /index.php break; fastcgi_pass unix:/home/phpdav/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; include fastcgi.conf; } }
你須要注意的root配置項,指向的目錄是項目代碼裏的interface目錄,你從github上獲取了個人項目代碼,會很快找到這個目錄
還有rewite配置項,不管訪問url爲什麼,通通重寫指向interface目錄裏的index.php,個人入口文件。
另:我還寫了一個我這個項目軟件的很是自動install.sh安裝腳本,打算在完善下在進行介紹。