设为首页 收藏本站
查看: 2369|回复: 0

[经验分享] 树莓派+seafile+nginx+ngrok实现私有云同步盘

[复制链接]

尚未签到

发表于 2018-11-11 14:21:33 | 显示全部楼层 |阅读模式
  环境:
  树莓派型号:2b
  树莓派系统:2015-05-05-raspbian-wheezy.img
  seafile版本:seafile-server_5.1.4_stable_pi.tar
  nginx版本:nginx1.10.3
  vps:搬瓦工,centos6,双核cpu,1G内存,10G硬盘
  ngrok服务端版本:1.7
  操作用户:root
  安装步骤:
  1.挂载移动硬盘作为seafile数据的存储目录
  #创建分区和格式化略过
  mount /dev/sda1 /mnt/seafileData
  #如果局域网内有其他samba设备,如智能路由,那么也可以直接挂载samba的共享,samba权限问题请自行处理
  sudo mount -t cifs -o username=***,password=*** //192.168.3.1/to-a1/SFData /home/pi/seafileData
  #查看设备的UUID和文件系统类型
  blkid /dev/sda1
  #开机自动挂载,编辑/etc/fstab
  UUID=755c1e5d-1318-430e-a3c0-a528635f31f6    /mnt/seafileData    ext3    defaults    0    0
  2.安装nginx
  #安装pcre库
  apt-get install libpcre3 libpcre3-dev
  #创建nginx用户和组
  groupadd  nginx
  useradd -r -g nginx -s /bin/nologin -M nginx
  #编译安装nginx
  ./configure \
  --prefix=/usr \
  --sbin-path=/usr/sbin/nginx \
  --conf-path=/etc/nginx/nginx.conf \
  --error-log-path=/var/log/nginx/error.log \
  --http-log-path=/var/log/nginx/access.log \
  --pid-path=/var/run/nginx/nginx.pid  \
  --lock-path=/var/lock/nginx.lock \
  --user=nginx \
  --group=nginx \
  --with-http_flv_module \
  --with-http_stub_status_module \
  --with-http_gzip_static_module \
  --http-client-body-temp-path=/var/tmp/nginx/client/ \
  --http-proxy-temp-path=/var/tmp/nginx/proxy/ \
  --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
  --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
  --http-scgi-temp-path=/var/tmp/nginx/scgi \
  --with-pcre \
  --with-http_realip_module
  make && make install
  #修改nginx配置文件/etc/nginx/nginx.conf
  #user  nobody;
  worker_processes  4;
  #error_log  logs/error.log;
  #error_log  logs/error.log  notice;
  #error_log  logs/error.log  info;
  #pid        logs/nginx.pid;
  events {
  worker_connections  60000;
  }
  http {
  include       mime.types;
  default_type  application/octet-stream;
  #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
  #                  '$status $body_bytes_sent "$http_referer" '
  #                  '"$http_user_agent" "$http_x_forwarded_for"';
  #access_log  logs/access.log  main;
  sendfile        on;
  #tcp_nopush     on;
  #keepalive_timeout  0;
  keepalive_timeout  65;
  #gzip  on;
  server {
  listen 80;
  server_name 你的域名;
  proxy_set_header X-Forwarded-For $remote_addr;
  location / {
  fastcgi_pass    127.0.0.1:8000;
  fastcgi_param   SCRIPT_FILENAME     $document_root$fastcgi_script_name;
  fastcgi_param   PATH_INFO           $fastcgi_script_name;
  fastcgi_param    SERVER_PROTOCOL        $server_protocol;
  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    SERVER_ADDR         $server_addr;
  fastcgi_param    SERVER_PORT         $server_port;
  fastcgi_param    SERVER_NAME         $server_name;
  fastcgi_param   REMOTE_ADDR         $remote_addr;
  access_log      /var/log/nginx/seahub.access.log;
  error_log       /var/log/nginx/seahub.error.log;
  }
  location /seafhttp {#seafile的文件存储目录
  rewrite ^/seafhttp(.*)$ $1 break;
  proxy_pass http://127.0.0.1:8082;
  client_max_body_size 0;
  proxy_connect_timeout  36000s;
  proxy_read_timeout  36000s;
  proxy_request_buffering off;
  }
  location /media {
  root /root/xumsi/seafile-server-latest/seahub;#seafile的网站根目录
  }
  }
  }
  3.安装seafile依赖
  #安装sqlite及其他依赖,或者你也可以去装mysql
  apt-get install sqlite sqlite3 python-setuptools python-imaging
  4.安装seafile
  mkdir /root/xumsi#创建seafile安装目录,将安装包拷贝到此处解压,并进入解压后的目录
  ./setup-seafile.sh#安装seafile,根据提示填写信息,第一项随便写,第二项建议直接填写ngrok映射的域名,后面数据目录填写挂载的移动硬盘,端口保持默认(否则要改配置文件)
  5.创建seafile文件存放目录并将该目录链接到seafile的网站根目录下
  mkdir /mnt/seafileData/seafhttp
  ln -s /mnt/seafileData/seafhttp/ /root/xumsi/seafile-server-latest/seahub/
  6.启动nginx、seafile和ngrok
  #启动nginx
  /usr/sbin/nginx -c /etc/nginx/nginx.conf
  #启动seafile
  /root/xumsi/seafile-server-5.1.4/seafile.sh start
  /root/xumsi/seafile-server-5.1.4/seahub.sh start-fastcgi
  #启动ngrok
  /root/ngrok_client/ngrok -subdomain xumsi -proto=http -config=/root/ngrok_client/ngrok.cfg 80 #
  7.登录http://你的域名,按下图设置
  SERVICE_URL:seafile的web地址,如:http://www.ceshi.com
  FILE_SERVER_ROOT:seafile上传文件的路径,上面面nginx中有配置,如:http://www.ceshi.com/seafhttp
DSC0000.png

  8.将nginx、seafile服务及ngrok客户端加入到开机启动项
  #编辑/etc/rc.local,加入以下内容
  mkdir /var/run/nginx
  /usr/sbin/nginx -c /etc/nginx/nginx.conf
  /root/xumsi/seafile-server-5.1.4/seafile.sh start
  /root/xumsi/seafile-server-5.1.4/seahub.sh start-fastcgi
  /root/ngrok_client/ngrok -subdomain xumsi -proto=http -config=/root/ngrok_client/ngrok.cfg 80 #
  注:以上内容要写在exit 0之前


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-633775-1-1.html 上篇帖子: 安装部署LNMP/大并发nginx优化/php性能加速 实战 下篇帖子: Logstash+Elasticsearch+Kibana+Nginx set up our private log query system-zhangdh
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表