关闭安全软件
[root@server ~]# setenforce 0
[root@server ~]# systemctl stop firewalld # 关闭防火墙
搭建LAMP环境
[root@server ~]# yum install httpd mariadb-server php* -y
[root@server ~]# cd /
[root@server /]# unzip /nextcloud-25.0.1.zip
设置nextcloud安装命令权限
[root@server /]# chmod -Rf 777 /nextcloud
[root@server /]# systemctl start mariadb # 启动数据库
[root@server /]# mysql
# 数据库设置
MariaDB [(none)]> create database nextcloud; # 创建数据库
MariaDB [(none)]> create user 'nextcloud'@'localhost' identified by '123456'; # 创建用户及密码
MariaDB [(none)]> grant all on nextcloud.* to 'nextcloud'@'localhost';
# 设置权限
MariaDB [(none)]> exit # 退出
[root@server /]# systemctl restart mariadb
[root@server /]# vim /etc/httpd/conf/httpd.conf
# 定位第124行修改如下:
DocumentRoot "/nextcloud"
<Directory "/nextcloud">
AllowOverride None
# Allow open access:
Require all granted
</Directory>
[root@server /]# systemctl restart httpd
[root@server ~]# vim /nextcloud/config/config.php
# 按照下面的内容对源文件进行修改
<?php
$CONFIG = array (
'instanceid' => 'ocif3g9giiwc',
'passwordsalt' => 'nzXf5wrB2QmOcw35btycuIbEGQ8DAq',
'secret' => 'D0EUghErW/BBmULBe/OwC1Ui+r9I+SsGLaRu8IpGNSpoEe1b',
'trusted_domains' =>
array (
0 => '192.168.48.130',
1 => '40a09234i8.imdo.co', # 添加花生壳给的域名,不要https或www等前缀
),
'datadirectory' => '/nextcloud/data',
'dbtype' => 'mysql',
'version' => '25.0.1.1',
'overwrite.cli.url' => 'https://40a09234i8.imdo.co:443', # 修改为花生壳给的域名,前面要有https,后面要有端口号
'dbname' => 'nextcloud',
'dbhost' => 'localhost',
'dbport' => '',
'dbtableprefix' => 'oc_',
'mysql.utf8mb4' => true,
'dbuser' => 'nextcloud',
'dbpassword' => '123456',
'installed' => true,
'overwritehost' => '40a09234i8.imdo.co:443', # 添加,域名更换为花生壳给的域名
'overwriteprotocol' => 'https', # 添加
);
注册并登陆腾讯云账号,同时,找点免费体验,拿到一台公网服务器,再进行以下配置,这里由于有php版本问题,所以,建议使用操作系统为centos8。
关闭安全软件
[root@server ~]# setenforce 0
[root@server ~]# systemctl stop firewalld # 关闭防火墙
搭建LAMP环境
[root@server ~]# yum install httpd mariadb-server php* -y
[root@server ~]# cd /
[root@server /]# unzip /nextcloud-25.0.1.zip
设置nextcloud安装命令权限
[root@server /]# chmod -Rf 777 /nextcloud
[root@server /]# systemctl start mariadb # 启动数据库
[root@server /]# mysql
# 数据库设置
MariaDB [(none)]> create database nextcloud; # 创建数据库
MariaDB [(none)]> create user 'nextcloud'@'localhost' identified by '123456'; # 创建用户及密码
MariaDB [(none)]> grant all on nextcloud.* to 'nextcloud'@'localhost';
# 设置权限
MariaDB [(none)]> exit # 退出
重启数据库
[root@server /]# systemctl restart mariadb
[root@server /]# vim /etc/httpd/conf/httpd.conf
# 定位第124行修改如下:
DocumentRoot "/nextcloud"
<Directory "/nextcloud">
AllowOverride None
# Allow open access:
Require all granted
</Directory>
重启httpd服务
[root@server /]# systemctl restart httpd
使用服务器搭建私有云时,如果有域名,同样要进行域名信任的配置(同内网穿透之后要进行的一样)。
[root@server ~]# vim /nextcloud/config/config.php
# 按照下面的内容对源文件进行修改
<?php
$CONFIG = array (
'instanceid' => 'ocif3g9giiwc',
'passwordsalt' => 'nzXf5wrB2QmOcw35btycuIbEGQ8DAq',
'secret' => 'D0EUghErW/BBmULBe/OwC1Ui+r9I+SsGLaRu8IpGNSpoEe1b',
'trusted_domains' =>
array (
0 => '192.168.48.130',
1 => '40a09234i8.imdo.co', # 添加花生壳给的域名,不要https或www等前缀
),
'datadirectory' => '/nextcloud/data',
'dbtype' => 'mysql',
'version' => '25.0.1.1',
'overwrite.cli.url' => 'https://40a09234i8.imdo.co:443', # 修改为花生壳给的域名,前面要有https,后面要有端口号
'dbname' => 'nextcloud',
'dbhost' => 'localhost',
'dbport' => '',
'dbtableprefix' => 'oc_',
'mysql.utf8mb4' => true,
'dbuser' => 'nextcloud',
'dbpassword' => '123456',
'installed' => true,
'overwritehost' => '40a09234i8.imdo.co:443', # 添加,域名更换为花生壳给的域名
'overwriteprotocol' => 'https', # 添加
);