08.nextcloud搭建
由于公司用的nfs文件共享系统满足不了权限需求,测试nextcloud是否符合要求
参考博客:
https://www.cnblogs.com/davidz/articles/9686716.html
安装使用的是root账号:
安装步骤: Centos7系统安装nextcloud-15.0.5,详细教程
一、# 先删除系统可能自带的PHP和nginx,用来面命令查找是否有安装
$ rpm -qa |grep php
$ rpm -qa |grep nginx
如果没有数据出来,就代表是干净的。
二、其实安装# 安装yum的epel源,这个是必须的 。
$ yum -y install epel-release
# 安装nginx
$ yum install -y nginx
systemctl enable nginx
systemctl start nginx
# 安装php的源
$ rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
# 安装php已经会用到扩展(扩展我这里提一句,已经要安装完,不然会有一些莫名其妙的报错)
$ yum install -y php70w-devel php70w-pear php70w-pecl php70w-gd php70w-opcache php70w-cli php70w-pdo php70w-process php70w-pecl-apcu php70w-mcrypt php70w-mysql php70w-fpm php70w-pecl-memcached php70w-common php70w-xml php70w-mbstring php70w-pecl-igbinary php70w-json php70w-pecl-apcu-devel php70w-intl
# 检查是否安装成功
# nginx -v
nginx version: nginx/1.12.2
# php -v
PHP 7.0.31 (cli) (built: Jul 20 2018 08:55:22) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.31, Copyright (c) 1999-2017, by Zend Technologies
到此,这两个重要组件就安装成功了,然后我们来安装mysql.
三、nextcloud 还需要数据库
安装数据库
yum install -y mariadb mariadb-server
第八步:
设计数据库开机自启动,并且手动启动数据库
systemctl enable mariadb.service
systemctl start mariadb.service
vi /etc/my.cnf
增加一行
character-set-server=utf8
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
重启服务
systemctl restart mariadb.service
mysqladmin -uroot password "123456"
mysql -uroot -p123456
grant all privileges on *.* to root@"192.168.50.171" identified by "123456" with grant option;
grant all privileges on *.* to root@"192.168.50.1" identified by "123456" with grant option;
四、为nextcloud 生成自签名ssl证书
mkdir /etc/nginx/cert/
$ cd /etc/nginx/cert/ # 没有则创建此文件夹
$ openssl req -new -x509 -days 36500 -nodes -out /etc/nginx/cert/nextcloud.crt -keyout /etc/nginx/cert/nextcloud.key #这里默认是365天,我本来想多搞几年,忘记了。还不知道下次怎么续订证书。呵呵
openssl req -new -x509 -days 36500 -nodes -out /etc/nginx/cert/nextcloud.crt -keyout /etc/nginx/cert/nextcloud.key
openssl req -new -x509 -days 36500 -nodes -newkey rsa:1024 -keyout /etc/nginx/cert/yun.key -out /etc/nginx/cert/yun.csr
# 会出现下面的选项需要填写,可以随便填。
Country Name (2 letter code) [XX]:cn //国家
State or Province Name (full name) []:guangdong //省份
Locality Name (eg, city) [Default City]:guangzhou //地区名字
Organization Name (eg, company) [Default Company Ltd]:Amos //公司名
Organizational Unit Name (eg, section) []:Technology //部门
Common Name (eg, your name or your server's hostname) []:Amos //CA主机名
Email Address []:Amos@Amos.com //Email地址
# 修改证书和文件夹权限
$ chmod 600 /etc/nginx/cert/*
$ chmod 700 /etc/nginx/cert
五、下载nextcloud,并配置php和nginx
# 下载nextcloud,官网地址为: https://nextcloud.com/install/#instructions-server
$ cd /usr/local/src
$ yum install -y wget unzip
$ wget https://download.nextcloud.com/server/releases/nextcloud-15.0.5.zip # 下载(这里虽然是13.0.2,后续会自动更新版本)
$ unzip nextcloud-15.0.5.zip # 解压
$ mv nextcloud /usr/share/nginx/html/ # 移动到指定文件夹内
$ cd /usr/share/nginx/html/nextcloud # 进行nextcloud 目录中
$ mkdir data # 创建数据文件夹
useradd nginx
$ chown nginx:nginx -R nextcloud/ # 将nextcloud文件授权给nginx
# 配置php-fpm
$ vim /etc/php-fpm.d/www.conf
-----------------------------------------------------------------------------------------
user = nginx //将用户和组都改为nginx
group = nginx
listen = 127.0.0.1:9000
env[HOSTNAME] = $HOSTNAME //将以下几行,去掉注释
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
------------------------------------------------------------------------------------------
# 为php创建session文件夹
$ mkdir -p /var/lib/php/session
$ chown nginx:nginx -R /var/lib/php/session/
# 配置nginx
$ cd /etc/nginx/conf.d/
$ vim nextcloud.conf (这里说一下,这个代码一定要copy,我亲测过,没有报错)
-------------------------------------------------------------------------------------------
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 twice
fastcgi_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 assets
access_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 assets
access_log off;
}
}
六、https://登陆是报配置文件问题:
cd /usr/share/nginx/html/nextcloud/config
vim config.php (在倒数第二行加)
'trusted_domains' =>
array (
0 => 'localhost' ,
1 => 'cloud.flybird.com' ,
2 => '192.168.50.177' ,
3 => '[fe80 :: 50:177]' ,
),
重启生效:
systemctl restart php-fpm
七、启动nginx和php-fpm
备注我的标准 系统是关闭了防火墙的,后来启动报错,建议在新建系统时不要关闭防火墙下面的代码我的系统没有测试到
$ nginx -t # 检查nginx配置是否正确,出现下面输入则正确。
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# 启动并设为开机启动 nginx,php-fpm
$ systemctl start nginx
$ systemctl enable nginx
$ systemctl start php-fpm
$ systemctl enable php-fpm
# 配置防火墙,开放http和https的端口。
$ firewall-cmd --add-port=80/tcp --permanent
$ firewall-cmd --add-port=443/tcp --permanent
$ firewall-cmd --reload
PS: 这里我的selinux是关闭的,如果selinux没有关闭,则执行下面命令关闭selinux
$ setenforce 0 # 关闭selinux
$ vim /etc/selinux/config # 修改配置,永久关闭。
------------------------------------------------------
SELINUX=disabled(添加这句话写在中间)
------------------------------------------------------
登陆配置数据库后的效果,我是试过很多搭建方案最终选此方案的,因为想集成Collabora Online在线编辑
08.nextcloud搭建的更多相关文章
- 基于 Ubuntu + nextCloud 搭建自己的私人网盘
提醒一下,如果之前通过apache搭建了网站,不要用snap命令来搭建,否则,至少有一个无法正常运行(不要问我怎么知道的,都是血的教训啊). 你可以通过腾讯云的实验主机进行尝试. 1.基础设置 切换为 ...
- Linux下使用nextcloud搭建个人网盘
市面上有那么多的网盘服务提供商,为什么还要自己搭建网盘呢?主要有以下原因: 免费的网盘都有种种限制,要么不限速容量小(onedriver,google driver),要么容量大限速(百度云) 付费网 ...
- nextcloud搭建私有云盘
一.基础环境准备 1.安装一台centos7的linux服务器. # 系统初始化 # 如果时区不对,请修改时区 #mv /etc/localtime /etc/localtime_bak #ln -s ...
- 服务器+nextcloud搭建自己的私有云盘
简介 Nextcloud是一款开源免费的私有云存储网盘项目,可以让你快速便捷地搭建一套属于自己或团队的云同步网盘,从而实现跨平台跨设备文件同步.共享.版本控制.团队协作等功能.它的客户端覆盖了Wind ...
- 使用NextCloud搭建私有网络云盘并支持Office文档在线预览编辑以及文件同步
转载自:https://www.bilibili.com/read/cv16835328?spm_id_from=333.999.0.0 0x00 前言简述 描述:由于个人家里的NAS以及公司团队对私 ...
- 基于Ubuntu + nextCloud 搭建自己的私人网盘
系统要求:Ubuntu 16.04.1 LTS 64 位操作系统 基础设置 切换为 root 账号 Ubutu 系统默认登录的用户为非 root 权限用户,为了能正常安装 nextCloud,需要切换 ...
- 小小白搭建nextcloud云盘
我是一名linux的小小白,今天就利用自己的所学搭建属于自己的云盘——nextcloud. 本人学生狗,普通的云盘也要几十块钱,既然我们只是拿来搭建巩固自己知识并不做为生产力,我们就用VMware W ...
- 搭建nextcloud私有云存储网盘
简介: 搭建个人云存储一般会想到ownCloud,堪称是自建云存储服务的经典.而Nextcloud是ownCloud原开发团队打造的号称是“下一代”存储. 真正试用过后就由衷地赞同这个Nextclou ...
- CentOS8 NextCloud 私有云存储搭建
本文首发:https://www.somata.work/2019/CentOS8NextCloudBuild.html 之前发现 Owncloud 越来越捞了,推出了企业版和社区版,近几日突然发现原 ...
随机推荐
- libgdx for eclipse开发环境搭建
1.安装jdk1.7以上 2.下载libgdx1.2.0 下载地址:https://libgdx.badlogicgames.com/releases 3.下载项目创建工具(老版本的) 下载地址:ht ...
- Oracle IMPDP导入数据案例之注意事项(undo/temp)
针对Oracle数据迁移,我们可能会用到expdp/impdp的方式,有时候需要大表.lob字段等可能会消耗过大的临时表空间和undo表空间,所以一般我们根据导出日志,在导入前适当调整表空间大小.否则 ...
- Hadoop学习---Hadoop的MapReduce的原理
MapReduce的原理 MapReduce的原理 NameNode:存放文件的元数据信息 DataNode:存放文件的具体内容 ResourceManager:资源管理,管理内存.CPU等 Node ...
- IE和Firefox浏览器CSS兼容性技巧整理
转自:http://homepage.yesky.com/185/11484185all.shtml#p11484185 CSS兼容常用技巧(1) 更多精彩相关文章推荐: 各大浏览器 CSS3 和 H ...
- ZT 创建类模式总结篇
创建类模式总结篇 分类: 设计模式 2012-03-26 09:03 7320人阅读 评论(11) 收藏 举报 编程优化设计模式任务 创建类模式主要关注对象的创建过程,将对象的创建过程进行封装,使客户 ...
- nohup命令、setsid命令、Daemon(守护进程)简要梳理
nohup命令 当用户注销(logout)或者网络断开时,终端会收到 HUP(hangup)信号从而关闭其所有子进程.因此,我们的解决办法就有两种途径:要么让进程忽略 HUP 信号,要么让进程运行在新 ...
- python UI自动化实战记录四:测试页面1-pageobject
该部分记录测试页面1-IndexPage,所有首页上的元素定位.操作.获取属性等方法都写在该类中. 1 首页类继承自BasePage 2 首页类第一部分写的是所有的定位器 3 首页类第二部分类的方法, ...
- Visual Studio中头文件stdafx.h的作用
在较新版的Visual Studio中,新生成的C++项目文件的的头文件夹下会默认有头文件stdafx.h,而源文件夹下则默认有源文件stdafx.cpp,手动将这些文件删除后,编译时系统还会报错.下 ...
- UVa 753 - A Plug for UNIX(最大流)
链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
- UVa 1151 - Buy or Build(最小生成树)
链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...