Nextcloud私有云盘搭建教程
环境:

操作系统:centos_7.6 x86-64mariadb:5.5.56-Mariadbphp:php 7.0.31nextcloud:nextcloud-13.0.5确保机器正常连网……

1.安装NGINX

安装 epel源yum instlal -y epel-releaseyum instlal -y nginx
启动nginxsystemctl start nginxsystemctl enable nginx

2.安装mariadb

更换国内的yum源cd /etc/yum.repo.d/wget -O Centos-Base.repo http://mirrors.aliyum.com/repo/Centos-7.repoyum clean all && yum makecache
如果是最小化安装的操作系统,是没有wget工具的,所发需要安装一下wgetyum install -y wget安装mariadb yum install -y mariadb-server mariadbsystemctl start mariadbsystemctl enable mariadb
设置数据库密码echo 'skip-grant-tables'>>/etc/my.cnfsystemctl restart maridbmysql -u root MariaDB [(none)]> use mysql;MariaDB [mysql]> select user, password, host from user;MariaDB [mysql]> update user set password=password('这里输入自己的密码') where User="root" and Host="localhost";MariaDB [mysql]> flush privileges;MariaDB [mysql]> exit注释掉/etc/my.cnf最后一行,重启数据库systemctl restart mariadbsystemctl enable mariadb

3.安装PHP

安装php及依赖插件yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpmyum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm安装php环境yum install yum-utilsyum-config-manager --enable remi-php70   [Install PHP 7.0]yum-config-manager --enable remi-php71   [Install PHP 7.1]yum-config-manager --enable remi-php72   [Install PHP 7.2]安装扩展yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo \php-devel php-pear php-gd php-opcache php-cli php-pdo php-process php-pecl-apcu php-mcrypt \php-mysql php-fpm php-pecl-memcached php-common php-xml php-mbstring php-pecl-igbinary-devel所有的组件都要安装哦,太长可以先复制到记事本,然后再复制到xshell或者mobaxter等远程工具。制作签名和SSL证书mkdir /etc/nginx/cert/cd /etc/nginx/cert/openssl rep -new -x509 -days 365 -nodes -out /etc/nginx/cert/nextcloud.crt -keyout /etc/nginx/cert/nextcloud.key赋权限chmod 600 /etc/nginx/cert/*chmod 700 /etc/nginx/cert/

4.下载Nextcloud

下载13.0.2版本cd /opt/wget https://download.nextcloud.com/server/releases/nextcloud-13.0.5.zipunzip nextcloud-13.0.5.zipcd /usr/share/nginx/htmlrm -rf *cp -R /op/nextcloud/* .chown -R nginx:nginx /usr/share/nginx/html

5.配置php和nginx

 配置PHPvim /etc/php-fpm.d/www.conf-------------------------------------user = nginx                                   //将用户和组都改为nginxgroup = nginxlisten = 127.0.0.1:9000env[HOSTNAME] = $HOSTNAME                     //将以下几行,去掉注释env[PATH] = /usr/local/bin:/usr/bin:/binenv[TMP] = /tmpenv[TMPDIR] = /tmpenv[TEMP] = /tmp-------------------------------------# 创建session文件夹mkdir -p /var/lib/php/sessionchown nginx:nginx -R /var/lib/php/session/配置Nginxcd /etc/nginx/conf.d/vim nextcloud.conf-------------------------------------
upstream php-handler {
server 127.0.0.1:9000;
#server unix:/var/run/php5-fpm.sock;
}
server {
listen 80;server_name localhost;# enforce https
rewrite ^(.*)$ https://$host$1 permanent;
}server {
listen 443 ssl;
server_name localhost;ssl_certificate /etc/nginx/cert/nextcloud.crt;
ssl_certificate_key /etc/nginx/cert/nextcloud.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=15768000;
includeSubDomains; preload;";
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 /usr/share/nginx/html/;       //这个地址要注意,是主页的保存地址,也就是解压nextcloud的地址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;
}# set max upload size
client_max_body_size 10240M;    # 上传文件最大限制,php.ini中也要修改,最后优化时会提及。
fastcgi_buffers 64 4K;# Disable gzip to avoid the removal of the ETag header
gzip on;
gzip_vary on;
gzip_comp_level 4;
gzip_min_length 256;
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;# 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)/ {deny all;
}
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {deny all;
}location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34])\.php(?:$|/) {include fastcgi_params;fastcgi_split_path_info ^(.+\.php)(/.*)$;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;fastcgi_param PATH_INFO $fastcgi_path_info;fastcgi_param HTTPS on;#Avoid sending the security headers twicefastcgi_param modHeadersAvailable true;fastcgi_param front_controller_active true;fastcgi_pass php-handler;fastcgi_intercept_errors on;fastcgi_request_buffering off;
}location ~ ^/(?:updater|ocs-provider)(?:$|/) {try_files $uri/ =404;index index.php;
}# Adding the cache control header for js and css files
# Make sure it is BELOW the PHP block
location ~* \.(?: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=15768000;includeSubDomains; preload;";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;
}
}注释掉默认配置文件里的80端口模块vim /etc/nginx/nginx.conf
#server {
#    listen       80 default_server;
#    listen       [::]:80 default_server;
#    server_name  _;
#    root         /usr/share/nginx/html;#    # Load configuration files for the default server block.
#    include /etc/nginx/default.d/*.conf;#    location / {
#    }#    error_page 404 /404.html;
#        location = /40x.html {
#    }#    error_page 500 502 503 504 /50x.html;
#        location = /50x.html {
#    }
#}

6.关掉SELINUX与防为墙

 setenforce 0sed -i "s/=enforcing/=disabled/g" /etc/selinux/config

7.web访问&&安装

 默认80,打开浏览器,输入你的服务器ip一切顺利的话成功进入登陆页面(不顺利应该是php扩展的原因,再调试):

8.性能调整

 admin用户登陆后页面上方会有警告提示,根据提示进行更改就好...

9.PHP

vim /etc/php.ini
[PHP]
# 添加如下配置
opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1upload_max_filesize = 10240M  #上传大小限制

10.缓存

yum install -y memcache
vim /etc/sysconfig/memcachedPORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="2048"
OPTIONS=""

11.nextcloud添加memcache缓存配置

vim /usr/share/nginx/html/config/config.php
'memcache.local' => '\OC\Memcache\APCu','memcache.distributed' => '\OC\Memcache\Memcached','memcached_servers' => array(array('localhost', 11211),),

12.重启

systemctl restart memcached
systemctl enable memcached

说明:本文完全是参照大佬的文章,边做边写,边总结,里面也有一些小提示,不喜勿喷。原文地址:https://www.jianshu.com/p/497a1f11e968 有什么问题也可以在下方留言,我们一起探讨。

如何搭建个人网盘 -Nextcloud个人云盘搭建完整过程-Centos系列相关推荐

  1. 使用Docker搭建NextCloud私人云盘+Collabora文件预览编辑

    使用Docker搭建NextCloud私人云盘+Collabora文件预览编辑 前言 开始搭建 编写docker-compose.yml文件 nginx.conf 启动容器 NextCloud配置 接 ...

  2. Docker搭建nextcloud使用云盘

    Docker搭建nextcloud使用云盘 1 下载nextcloud # 下载镜像 docker pull nextcloud:25.0.0 2 docker-compe安装 创建yml文件,名称是 ...

  3. 搭建nextcloud私人云盘

    搭建nextcloud私人云盘 1. Linux发行版本 本人的设备是OragePi4,安装的是基于debian的Armbian Buster Server,树莓派,云主机等可以安装对应的版本. 2. ...

  4. [折腾日记]NextCloud 私人云盘部署教程

    NextCloud 私人云盘部署教程 你是否还在使用微信来分享文件?微信虽然可以传输文件,却无法帮你存储文件,更无法整理你的诸多文件.一个月以前发给某个同事的文件,你要找很久才找到,而且可能会发现&q ...

  5. 小米云能同步到华为手机上吗_有没有小米还没涉足的产业?对标百度网盘,小米云盘即将上线...

    打开小米的云服务界面,我们可以看到上面显示"小米云盘即将上线,敬请期待",这难道是小米正式推出网盘服务的信号?. 小米云服务是小米面对用户开放的云端数据备份系统,提供数据同行.数据 ...

  6. PC端网易云音乐播放云盘音乐时显示加载失败,自动调转下一首的解决方法

    PC端网易云音乐播放云盘音乐时显示加载失败,自动调转下一首解决方法 注意: 一定要看看是不是和你的情况一样,不一样不要用这种方法!!! 具体情况: 我们经常会下载歌曲存到电脑文件夹里,然后通过网易云音 ...

  7. 你了解个人云盘和企业云盘有什么区别吗?

    企业云盘和个人云盘的基本功能都是存储.共享,差异在于协作功能实现的细节上.个人的主要用于存储个人自己的文件,常用的功能就是同存上传存储.简单的分享,如:外链.推送等功能.而企业面向的是企业内部的所有员 ...

  8. 故障定位:netapp(nfs)从云盘快照创建云盘失败Volume xxx could not be created on shares.

    一背景 cinder对接了netapp(nfs),创建云盘和快照功能正常, 但是从云盘快照创建云盘失败,报错 Volume xxx could not be created on shares. 二 ...

  9. Alist+RaiDrive挂载天翼云盘、阿里云盘

    目录 一.工具介绍 1.1.Alist 1.2.RaiDrive 二.Alist支持的存储​ 三.安装 3.1. Windows (1)安装 (2)启动服务 (3)登录 (4)添加天翼云盘 (5)开机 ...

最新文章

  1. 写一个图片预览器(react-native),温习一下初中数学
  2. django验证码模块使用
  3. 【Python】Python Mako模板使用
  4. mcq 队列_MCQ | 8086微处理器中的字符串操作指令
  5. ajax json 封装,Ajax--json(Ajax调用返回json封装代码、格式及注意事项)
  6. 移动端采用Flexible将PX转换REM适配及开发中Retina屏1px边框的两种解决方案
  7. 索引更新:刚发布的文章就能被搜到,这是怎么做到的?
  8. linux文件描述符、软硬连接、输入输出重定向
  9. eclipse(Kepler Service Release 2)问题记录
  10. 实现算法2.15、2.16的程序(一个数组只生成一个静态链表)
  11. 35. 源码与 Tarball
  12. Map.Entry的使用(转载)
  13. 重庆师范大学c语言考研真题及答案,2020年重庆师范大学系统理论考研真题试卷及试题答案,数学分析考研试题下载...
  14. php 远程下载木马
  15. 什么是SaaS,PaaS和IaaS? 有例子
  16. html+css画虚线,实线
  17. VIN码识别-汽修行业新技术
  18. 湖南大学计算机通信学院陈果,湖南大学考研研究生导师简介-陈果
  19. 高中数学基础-2.1.1(1)根式的运算
  20. [日常] go语言圣经-声明,变量,赋值,类型,包和文件习题

热门文章

  1. Java代码工具之中英文语句分词
  2. c++的3D游戏笔录-基于panda3d(4)
  3. 用python做一个车牌识别_如何用 Python 识别车牌
  4. basler运用pylon开发步骤
  5. 饥荒steam服务器文档,Steam饥荒专用服务器搭建
  6. iphone 绘图 虚线的画法
  7. 总结OnOK、OnCancel、OnDestroy函数之间的区别
  8. JS数据类型lianxi
  9. vue 一直加载_vue加载中loading提示信息(iView Spin)
  10. 联发科MT6589处理器解析