网盘关门了怎么办?自己弄!

/ 5评 / 0

不久前听闻,360网盘要关闭的消息,其实对我来说是一点影响都没有的,毕竟我一直倡导大家不要用任何360公司旗下的产品。

0EjKr58jHc

随后百度网盘也传出要关,这样一看免费网盘的路确实没什么人愿意走了,幸好GOOGLE网盘长存。对于重度网盘使用者来说,没有网盘大概是很不方便的。

事实上我对国内所谓传播盗版的网盘一点兴趣都没有,毕竟美剧靠人人就够了……然鹅和我不相关的事情能动手解决也是一件好玩的事……
解决办法——租个VPS自己搭一个网盘。

1c3f3f27-b2be-48c5-94f2-b6b7c7e77923

不得不说,国外开源软件真是好,只要你自己用,不涉及商业,那产品是又好又免费的,这款owncloud就是,官方网站点这里

E23A.tm

owncloud支持PC,MAC,IPHONE,ANDROID多客户端之间文件共享,手机APP也是开源的,APPSTORE官方售价6元,别人自己编译的挂商店是免费的,经测试好用。

306982620772177893

免费版允许自定义添加用户,也就是说可以多人一起分享这个网盘,不过不支持他人自己注册,估计商业版就可以了,对网盘有依赖的,还怕网盘随时关闭的可以自己动手弄一个了。

以下为没人要看的如何搭建部分:

最新版的owncloud要求php最低5.4版本,对apache支持比较好,nginx同样可用,官方建议使用https。

安装以centOs 6.5 lnmp为例

cd 你的安装目录
wget https://download.owncloud.org/community/owncloud-9.1.1.zip
unzip owncloud-9.1.1.zip

然后设置msql数据库

mysql -u root -p
create database 你的数据库名字
use 你的数据库名字
insert into mysql.user(Host,User,Password) values("localhost","用户名",password("密码"));
flush privileges;
grant all privileges on 你的数据库名字.* to '用户名'@'localhost' identified by '密码';
flush privileges;

最烦的调试最久的是nginx的配置,官方的nginx example不可用,需要重写,可以直接用以下设置。

upstream php-handler {
  server 127.0.0.1:9000;
  #server unix:/var/run/php5-fpm.sock;
  }

server {
    listen 80;
    server_name 域名;
    # enforce https
    return 301 https://$server_name$request_uri;
}


server {
  listen 443 ssl;
  server_name 域名;



    ssl_certificate ssl证书地址;
    ssl_certificate_key ssl key地址;

    # Add headers to serve security related headers
    # Before enabling Strict-Transport-Security headers please read into this topic first.
    #add_header Strict-Transport-Security "max-age=15552000; includeSubDomains";
    add_header X-Content-Type-Options nosniff;
    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Robots-Tag none;
    add_header X-Download-Options noopen;
    add_header X-Permitted-Cross-Domain-Policies none;

   # Path to the root of your installation
  root **安装路径**;
  # set max upload size
  client_max_body_size 10G;
  fastcgi_buffers 64 4K;
  # Disable gzip to avoid the removal of the ETag header
  gzip off;
  # Uncomment if your server is build with the ngx_pagespeed module
  # This module is currently not supported.
  #pagespeed off;
  rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
  rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
  rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;
  index index.php;
  error_page 403 /core/templates/403.php;
  error_page 404 /core/templates/404.php;
  location = /robots.txt {
    allow all;
    log_not_found off;
    access_log off;
    }
location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README){
    deny all;
    }
  location / {
   # The following 2 rules are only needed with webfinger
   rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
   rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
   rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
   rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
   rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
   try_files $uri $uri/ /index.php;
   }
   location ~ \.php(?:$|/) {
   fastcgi_split_path_info ^(.+\.php)(/.+)$;
   include fastcgi_params;
   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
   fastcgi_param PATH_INFO $fastcgi_path_info;
   fastcgi_pass php-handler;
   }
   # Optional: set long EXPIRES header on static assets
   location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
       expires 30d;
       # Optional: Don't log access to assets
         access_log off;
   }
}

最后安装owncloud的一些细节:

17cdde0f4bfbfbedca0dc69c7ff0f736aec31f5b

进入owncloud目录后要创建一个data文件夹,并在文件夹内放一个空的.ocdata文件

cd .ocdata 
mkdir data
vi .ocdata

然后退到owncloud文件夹外

chown -R apache:apache 安装路径/owncloud/

注:apache:apache 为php-fpm的用户组和用户,不同操作系统对应的用户名不同。

最后浏览网页一键安装就可以用啦。

5 responses to “网盘关门了怎么办?自己弄!”

  1. 流氓肚 says:

    噶好的文章哪能没人点赞~

  2. AnthonyNer says:

    No matter how you do it, losing weight is an individual thing. Friends can help you but they can’t lose the weight for you. You’ve got to take charge of your weight loss from the beginning if you want to get serious about losing weight. The following tips will help.

Leave a Reply

Your email address will not be published.