热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

在阿里云上创建一个个人网盘(owncloud)

简介说真的现在的网盘真的是垃圾垃圾垃圾各种限速,各种会员比如百度云盘那为什么不自己搭建一个网盘,朋友的推荐是owncloud,那么就来搭建

简介

说真的现在的网盘真的是垃圾垃圾垃圾各种限速,各种会员比如百度云盘
那为什么不自己搭建一个网盘,朋友的 推荐是owncloud,那么就来搭建一下

安装lnmp

首先要安装lnmp,下面先列一下owncloud的环境要求

  • Operating System:Ubuntu 16.04, Debian 7 and 8, SUSE Linux Enterprise Server 12 and 12 SP1, Red Hat Enterprise Linux/Centos 6.5 and 7
  • Database:MySQL or MariaDB 5.5+, Oracle 11g, PostgreSQL, & SQLite
  • Web server:Apache 2.4 with mod_php
  • PHP Runtime:PHP (5.6+ or 7.0+)

为了方便我就使用lnmp一键安装包来安装了
先下载screen
yum install screen
这个是为了防止网络中断导致安装中断
之后创建一个会话来安装lnmp
screen -S lnmp
接着下载安装脚本
wget http://soft.vpser.net/lnmp/lnmp1.4.tar.gz
之后解压
tar -zxvf lnmp1.4.tar.gz

[root@iZuf65l667kvowasvo93k6Z ~]# cd lnmp1.4
[root@iZuf65l667kvowasvo93k6Z lnmp1.4]# ls
addons.sh ChangeLog conf include init.d install.sh License lnmp.conf pureftpd.sh README src tools uninstall.sh upgrade1.x-1.4.sh upgrade.sh

执行那个install.sh就好了
./install.sh

+------------------------------------------------------------------------+
| LNMP V1.4 for CentOS Linux Server, Written by Licess |
+------------------------------------------------------------------------+
| A tool to auto-compile & install LNMP/LNMPA/LAMP on Linux |
+------------------------------------------------------------------------+
| For more information please visit https://lnmp.org |
+------------------------------------------------------------------------+
You have 5 options for your DataBase install.
1: Install MySQL 5.1.73
2: Install MySQL 5.5.56 (Default)
3: Install MySQL 5.6.36
4: Install MySQL 5.7.18
5: Install MariaDB 5.5.56
6: Install MariaDB 10.0.30
7: Install MariaDB 10.1.23
0: DO NOT Install MySQL/MariaDB
Enter your choice (1, 2, 3, 4, 5, 6, 7 or 0): 4
You will install MySQL 5.7.18
===========================
Please setup root password of MySQL.(Default password: root)
Please enter: 你的密码
MySQL root password: 你的密码
===========================
Do you want to enable or disable the InnoDB Storage Engine?
Default enable,Enter your choice [Y/n]:
No input,The InnoDB Storage Engine will enable.
===========================
You have 6 options for your PHP install.
1: Install PHP 5.2.17
2: Install PHP 5.3.29
3: Install PHP 5.4.45
4: Install PHP 5.5.38 (Default)
5: Install PHP 5.6.31
6: Install PHP 7.0.21
7: Install PHP 7.1.7
Enter your choice (1, 2, 3, 4, 5, 6 or 7): 7
You will install PHP 7.1.7
===========================
You have 3 options for your Memory Allocator install.
1: Don't install Memory Allocator. (Default)
2: Install Jemalloc
3: Install TCMalloc
Enter your choice (1, 2 or 3):
No input,You will not install Memory Allocator.Press any key to install...or Press Ctrl+c to cancel

回车安装
你可以输入ctrl+a+d来退出这个会话。输入screen -r来进入这个会话
安装时间视配置来决定

============================== Check install ==============================
Checking ...
Nginx: OK
MySQL: OK
PHP: OK
PHP-FPM: OK
Clean src directory...
+------------------------------------------------------------------------+
| LNMP V1.4 for CentOS Linux Server, Written by Licess |
+------------------------------------------------------------------------+
| For more information please visit https://lnmp.org |
+------------------------------------------------------------------------+
| lnmp status manage: lnmp {start|stop|reload|restart|kill|status} |
+------------------------------------------------------------------------+
| phpMyAdmin: http://IP/phpmyadmin/ |
| phpinfo: http://IP/phpinfo.php |
| Prober: http://IP/p.php |
+------------------------------------------------------------------------+
| Add VirtualHost: lnmp vhost add |
+------------------------------------------------------------------------+
| Default directory: /home/wwwroot/default |
+------------------------------------------------------------------------+
| MySQL/MariaDB root password: 你的密码 |
+------------------------------------------------------------------------+
+-------------------------------------------+
| Manager for LNMP, Written by Licess |
+-------------------------------------------+
| https://lnmp.org |
+-------------------------------------------+
nginx (pid 10396 10394) is running...
php-fpm is runing!SUCCESS! MySQL running (10924)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
Install lnmp takes 68 minutes.
Install lnmp V1.4 completed! enjoy it.

出现上面界面表示安装完成

安装owncloud

首先下载owncloud
wget https://download.owncloud.org/community/owncloud-10.0.2.tar.bz2
接着解压
unzip owncloud-10.0.2.zip
之后放入一个站点文件夹中
mv owncloud /home/wwwroot/
接着配置nginx
cd /usr/local/nginx/conf/vhost/
vim owncloud.conf
输入下面内容


upstream php-handler {#server 127.0.0.1:9000;server unix:/tmp/php-cgi.sock;
}server {listen 80;server_name 106.14.192.149;# 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 installationroot /home/wwwroot/owncloud;location = /robots.txt {allow all;log_not_found off;access_log off;}# The following 2 rules are only needed for the user_webfinger app.# Uncomment it if you're planning to use this app.#rewrite ^/.well-known/host-meta /public.php?service=host-meta last;#rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;location = /.well-known/carddav {return 301 $scheme://$host/remote.php/dav;}location = /.well-known/caldav {return 301 $scheme://$host/remote.php/dav;}location /.well-known/acme-challenge { }# set max upload sizeclient_max_body_size 16400M;fastcgi_buffers 64 4K;fastcgi_read_timeout 600;client_body_buffer_size 1048576k;client_body_temp_path /tmp/owncloud;# Disable gzip to avoid the removal of the ETag headergzip off;# Uncomment if your server is build with the ngx_pagespeed module# This module is currently not supported.#pagespeed off;error_page 403 /core/templates/403.php;error_page 404 /core/templates/404.php;location / {rewrite ^ /index.php$uri;}location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {return 404;}location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {return 404;}location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34])\.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_param HTTPS on;fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twicefastcgi_param front_controller_active true;fastcgi_pass php-handler;fastcgi_intercept_errors on;fastcgi_request_buffering off; #Available since nginx 1.7.11}location ~ ^/(?:updater|ocs-provider)(?:$|/) {try_files $uri $uri/ =404;index index.php;}# Adding the cache control header for js and css files# Make sure it is BELOW the PHP blocklocation ~* \.(?:css|js)$ {try_files $uri /index.php$uri$is_args$args;add_header Cache-Control "public, max-age=7200";# Add headers to serve security related headers (It is intended to have those duplicated to the ones above)# 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;# Optional: Don't log access to assetsaccess_log off;}location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ {try_files $uri /index.php$uri$is_args$args;# Optional: Don't log access to other assetsaccess_log off;}
}

这样nginx就配置好了,注意的是如果fastcgi_pass unix:/tmp/php-cgi.sock这个配置错误,那么就会报502错误
接着配置数据库
mysql -uroot -p
创建一个数据库
create database owncloud;
在浏览器中输入你的地址访问


如果出现上面的错误,那么就要把你的那个目录的权限修改一下
比如
chown www:www owncloud/
点击storge&database设置你的数据库,(玩玩用sqlite就好了,生产用mysql,mysql配置我就不说了)然后设置你的管理员账号和密码,之后就可以登录了

客户端

owncloud的客户端是全平台的,连linux都有,所以66666666,因为我是ubuntu的所以就安装ubuntu了
输入下面命令
sudo sh -c "echo 'deb http://download.opensuse.org/repositories/isv:/ownCloud:/desktop/Ubuntu_16.04/ /' > /etc/apt/sources.list.d/owncloud-client.list"
加入软件源
然后加入秘钥
wget -nv http://download.opensuse.org/repositories/isv:ownCloud:desktop/Ubuntu_16.04/Release.key -O Release.key
sudo apt-key add -
更新软件源
sudo apt-get update
安装owncloud
sudo apt-get install owncloud-client
之后打开客户端,会让你设置server address


如果出现
Error downloading https://myip/owncloud/status.php - server replied: Internal Server Error"
这样的错误请重启一下php-fpm

Have Fun



推荐阅读
  • PDO MySQL
    PDOMySQL如果文章有成千上万篇,该怎样保存?数据保存有多种方式,比如单机文件、单机数据库(SQLite)、网络数据库(MySQL、MariaDB)等等。根据项目来选择,做We ... [详细]
  • 本文介绍了在Mac上搭建php环境后无法使用localhost连接mysql的问题,并通过将localhost替换为127.0.0.1或本机IP解决了该问题。文章解释了localhost和127.0.0.1的区别,指出了使用socket方式连接导致连接失败的原因。此外,还提供了相关链接供读者深入了解。 ... [详细]
  • 阿里云主机实战应用之centos7上的防火墙设置
    最近公司又上了一台服务器,以前都是用centos6系统,这次选择使用了centos7系统的安装镜像,因为现在程序版本在centos7上一般php默认就是5.4以上的,mysql也 ... [详细]
  • 如何部署Zabbix监控实现监测和报警机制
    这篇文章的知识点包括:Zabbix的安装部署、Zabbix监控的实现以及Zabbix报警机制的实现,阅读完整文相信大家对Zabbix监控的使用有了一定的认识。Zabb ... [详细]
  • Centos7.6安装Gitlab教程及注意事项
    本文介绍了在Centos7.6系统下安装Gitlab的详细教程,并提供了一些注意事项。教程包括查看系统版本、安装必要的软件包、配置防火墙等步骤。同时,还强调了使用阿里云服务器时的特殊配置需求,以及建议至少4GB的可用RAM来运行GitLab。 ... [详细]
  • 如何在服务器主机上实现文件共享的方法和工具
    本文介绍了在服务器主机上实现文件共享的方法和工具,包括Linux主机和Windows主机的文件传输方式,Web运维和FTP/SFTP客户端运维两种方式,以及使用WinSCP工具将文件上传至Linux云服务器的操作方法。此外,还介绍了在迁移过程中需要安装迁移Agent并输入目的端服务器所在华为云的AK/SK,以及主机迁移服务会收集的源端服务器信息。 ... [详细]
  • CentOS 7部署KVM虚拟化环境之一架构介绍
    本文介绍了CentOS 7部署KVM虚拟化环境的架构,详细解释了虚拟化技术的概念和原理,包括全虚拟化和半虚拟化。同时介绍了虚拟机的概念和虚拟化软件的作用。 ... [详细]
  • CentOS 6.5安装VMware Tools及共享文件夹显示问题解决方法
    本文介绍了在CentOS 6.5上安装VMware Tools及解决共享文件夹显示问题的方法。包括清空CD/DVD使用的ISO镜像文件、创建挂载目录、改变光驱设备的读写权限等步骤。最后给出了拷贝解压VMware Tools的操作。 ... [详细]
  • mac php错误日志配置方法及错误级别修改
    本文介绍了在mac环境下配置php错误日志的方法,包括修改php.ini文件和httpd.conf文件的操作步骤。同时还介绍了如何修改错误级别,以及相应的错误级别参考链接。 ... [详细]
  • Centos7搭建ELK(Elasticsearch、Logstash、Kibana)教程及注意事项
    本文介绍了在Centos7上搭建ELK(Elasticsearch、Logstash、Kibana)的详细步骤,包括下载安装包、安装Elasticsearch、创建用户、修改配置文件等。同时提供了使用华为镜像站下载安装包的方法,并强调了保证版本一致的重要性。 ... [详细]
  • LVS实现负载均衡的原理LVS负载均衡负载均衡集群是LoadBalance集群。是一种将网络上的访问流量分布于各个节点,以降低服务器压力,更好的向客户端 ... [详细]
  • PHP组合工具以及开发所需的工具
    本文介绍了PHP开发中常用的组合工具和开发所需的工具。对于数据分析软件,包括Excel、hihidata、SPSS、SAS、MARLAB、Eview以及各种BI与报表工具等。同时还介绍了PHP开发所需的PHP MySQL Apache集成环境,包括推荐的AppServ等版本。 ... [详细]
  • k8s+springboot+Eureka如何平滑上下线服务
    k8s+springboot+Eureka如何平滑上下线服务目录服务平滑上下线-k8s版本目录“上篇介绍了springboot+Euraka服务平滑上下线的方式,有部分小伙伴反馈k ... [详细]
  • 问题描述:域名已经备案,我全部都有,也在后台配置了,但是手机预览,还是请求失败,PC端是可以请求 ... [详细]
  • 篇首语:本文由编程笔记#小编为大家整理,主要介绍了CentOS7编译mysql8.0.12相关的知识,希望对你有一定的参考价值。步骤一:安装 ... [详细]
author-avatar
踏山321
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有