目前有好多的雲端儲存的服務,如百度雲、360雲、Dropbox之類,雖然國產的雲提供了大空間儲存,但是總是有點怪異,目前百度雲在下載方面出現了限速的行為,非要開通會員才能全速下載,弄得幾百兆的寬頻只能以200kb的速度下載,非常的不舒服。 Dropbox和OneDrive都是國外的雲端服務,還有GoogleDrive之類,雖然給的空間比較小,但也都是良心之作,Dropbox算是我用的最好用的儲存服務了。但就是需要配合SS用,OneDrive雖然在國內可用,但是用不習慣。
國外雲端儲存 前段時間在網路上遊盪的時候發現國外有一款比較好的私人儲存Pydio,不過是需要擁有自己的伺服器或者主機才行,而手頭恰好有一台空的VPS,於是就用來安裝Pydio。在Pydio的官方文檔中提供了Apache的安裝設定方法,沒有Nginx的,採用預設的方式安裝,將Pydio的安裝包解壓到目錄下,一路就可以安裝完成,但是會出現兩個問題: 頁面再次重新整理會404; Windows用戶端串連不上; 其中在Windows用戶端串連時會出現: Error while trying to connect to http://xxx.xxx.xx : Server not found (404), is it up and has it Pydio installed ? 根據判斷,應該是Nginx的重新導向沒有設定好,需要重新設定網站的conf設定檔。在論壇上四處搜尋了一下,發現出現這個問題的人不少,於是再次求助於官方文檔,在官方的一個文章中找到了一個在Debian的Nginx環境下的配置方法,結合lnmp的設定檔,自己改動了一下,順利完成了重新導向的配置,下面貼出了具體的設定檔,以防忘記:
server
{
listen 80;
server_name cloud.defel.net;
# enforce https
return 301 https://$server_name$request_uri;
add_header X-Frame-Options "SAMEORIGIN";
}
server
{
listen 443 ssl;
#listen [::]:80;
server_name cloud.defel.net;
index index.html index.htm index.php default.html default.htm default.php;
### If you changed the maximum upload size in PHP.ini, also change it below
client_max_body_size 5120M;
# Prevent Clickjacking
add_header X-Frame-Options "SAMEORIGIN";
root /home/wwwroot/cloud.defel.net;
ssl_certificate /etc/pki/tls/certs/1_cloud.defel.net_bundle.crt;
ssl_certificate_key /etc/pki/tls/certs/2_cloud.defel.net.key;
add_header Strict-Transport-Security "max-age=16070400; includeSubdomains";
include other.conf;
rewrite ^/dashboard|^/settings|^/welcome|^/ws- /index.php last;
if ( !-e $request_filename ) {
# WebDAV Rewrites
rewrite ^/shares /dav.php last;
# Sync client
rewrite ^/api /rest.php last;
# External users
rewrite ^/user ./index.php?get_action=user_access_point last;
# Public shares
rewrite ^/data/public/([a-zA-Z0-9_-]+)\.php$ /data/public/share.php?hash=$1?;
}
rewrite ^/data/public/([a-zA-Z0-9_-]+)--([a-z]+)$ /data/public/share.php?hash=$1&lang=$2?;
rewrite ^/data/public/([a-zA-Z0-9_-]+)$ /data/public/share.php?hash=$1?;
#error_page 404 /404.html;
# Remove direct access to the following folders & files
location ~* ^/(?:\.|conf|data/(?:files|personal|logs|plugins|tmp|cache)|plugins/editor.zoho/agent/files)
{
deny all;
}
location ~* /data/public/.*.(ser|htaccess)$
{
deny all;
}
# Stops the annoying error messages in the logs
location ~* ^/(favicon.ico|robots.txt)
{
log_not_found off;
}
# WebDAV Rewrites
location /shares
{
if (!-f $request_filename) {
rewrite ^/shares /dav.php last;
break;
}
if (!-d $request_filename) {
rewrite ^/shares /dav.php last;
break;
}
}
# Enables PHP
location ~ \.php$
{
# comment try_files $uri =404; to enable pathinfo
try_files $uri =404;
fastcgi_param HTTPS on;
set $request_url $request_uri;
if ( $uri ~ ^/(index|plugins) )
{
set $request_url /;
}
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_param REQUEST_URI $request_url;
fastcgi_index index.php;
include fastcgi.conf;
include fastcgi_params;
#include pathinfo.conf;
}
# Enables Caching
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$
{
expires 7d;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
access_log /home/wwwlogs/cloud.defel.net.log access;
}
這裡的設定檔是啟用了SSL加密的,也是官方推薦的,如果不需要啟動,則需要進行幾點改動: 刪除重新導向部分; 修改監聽連接埠443為80; 刪除SSL認證兩行; 同時這個是啟用了日誌功能的,也是可以關閉的,另外其他網域名稱使用需要修改設定檔中的網域名稱。 PS:修改上傳大小可以再php.ini中修改:
vi /etc/php.ini
找到下面進行修改:
[...]
upload_max_filesize = 1024M
[...]
post_max_size = 1024M
[...]
output_buffering = Off
[...]