首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

动手实验:部署私有云盘“NextCloud”

上篇《Linux部署Nginx+Mysql+PHP+PHPMyAdmin4环境》中,我们通过文章已经学会基本的LNMP环境的部署,本次开始部署一套私有云盘来来验证环境,并提升对Linux认识与兴趣。

首先介绍一下此次任务主角NextCloud:

NextCloud的前身叫Owncloud,Owncloud的老大被投资后不满产品商业化气息太重,Owncloud GmbH(德国)和OwncloudInc(美国)之间逐渐形成了无法逾越的鸿沟。公司开始通过提供技术支持赚钱,并向其他领域扩张,抱怨的声音开始在开源社区久久回荡。于是决定愤然离职重新开发了NextCloud。事实证明确实要比 OwnCloud 更体贴好用!

1

开始安装-下载

NextCloud官网:https://www.nextcloud.com

网站上有各种平台的部署包,有ovf、docker、tar等等,我们采取TAR包的形式部署。

[root@VM-01 /]# cd /tmp

[root@VM-01 tmp]# wget https://download.nextcloud.com/server/releases/nextcloud-13.0.2.tar.bz2

[root@VM-01 tmp]# tar -jxvf nextcloud-13.0.2.tar.bz2

[root@VM-01 tmp]# mv nextcloud /www

[root@VM-01 tmp]# chown -R apache:apache /www/nextcloud

[root@VM-01 tmp]# chmod 777 /www/nextcloud/config

[root@VM-01 tmp]# mkdir /data

[root@VM-01 tmp]# chown -R apache:apache /data

2

开始安装-配置数据库

修改默认字符集:uft8mb4

[root@VM-01 /]# vim /etc/my.cnf

添加utf8mb4配置如图

[client]

default-character-set = utf8mb4

[mysql]

default-character-set = utf8mb4

[mysqld]

character-set-client-handshake = FALSE

character-set-server = utf8mb4

collation-server = utf8mb4_unicode_ci

init_connect='SET NAMES utf8mb4'

innodb_large_prefix=ON

innodb_file_format=Barracuda

innodb_file_per_table=ON

[root@VM-01 /]# service mysqld restart

[root@VM-01 /]# mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.7.22 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show variables like "%character%";show variables like "%collation%";

+--------------------------+----------------------------+

| Variable_name | Value |

+--------------------------+----------------------------+

| character_set_client | utf8mb4 |

| character_set_connection | utf8mb4 |

| character_set_database | utf8mb4 |

| character_set_filesystem | binary |

| character_set_results | utf8mb4 |

| character_set_server | utf8mb4 |

| character_set_system | utf8 |

| character_sets_dir | /usr/share/mysql/charsets/ |

+--------------------------+----------------------------+

8 rows in set (0.01 sec)

+----------------------+--------------------+

| Variable_name | Value |

+----------------------+--------------------+

| collation_connection | utf8mb4_unicode_ci |

| collation_database | utf8mb4_unicode_ci |

| collation_server | utf8mb4_unicode_ci |

+----------------------+--------------------+

3 rows in set (0.02 sec)

mysql> create database nextcloud;

Query OK, 1 row affected (0.02 sec)

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| nextcloud |

| performance_schema |

| phpmyadmin |

| sys |

+--------------------+

6 rows in set (0.00 sec)

坑一:SQLSTATE[HY000] [2019] Can't initialize character set utf8mb4 (path: /usr/share/mysql/charsets/)

[root@VM-01 /]# yum remove php56w-mysql

[root@VM-01 /]# yum install php56w-mysqlnd

3

开始安装-配置Nginx,开启pathinfo。

[root@VM-01 /]# cd /etc/nginx/conf.d

[root@VM-01 conf.d]# cp default.conf nextcloud.conf

[root@VM-01 conf.d]# vim nextcloud.conf

server {

listen 8082;

server_name localhost;

client_max_body_size 1000m;

#charset koi8-r;

access_log /var/log/nginx/nextcloud.log main;

location / {

root /www/nextcloud;

index index.html index.htm index.php;

}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html

#

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root /usr/share/nginx/html;

}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80

#

#location ~ \.php$ {

# proxy_pass http://127.0.0.1;

#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

#

location ~ [^/]\.php(/|$)

{

root /www/nextcloud;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include fastcgi_params;

fastcgi_split_path_info ^(.+?\.php)(/.*)$;

set $path_info $fastcgi_path_info;

fastcgi_param PATH_INFO $path_info;

try_files $fastcgi_script_name =404;

}

# deny access to .htaccess files, if Apache's document root

# concurs with nginx's one

#

location ~ /\.ht {

deny all;

}

}

4

Web安装-NextCloud

访问:http://192.168.18.232:8082

当你看到最后的页面说明已经安装成功了,快享受技术带来的愉悦感吧!:)

我在公网上也部署了这套系统,有兴趣的同学要是着急体验对比可以直接访问:

NextCloud

http://111.231.86.247:8084

Name: Guest

Password: www.richcan

OwnCloud

http://111.231.86.247:8082

Name: Guest

Password: www.richcan

全文完!

  • 发表于:
  • 原文链接http://kuaibao.qq.com/s/20180507G0SR6J00?refer=cp_1026
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券