一、安装PHP8.0以上
我这里使用PHP8.0.30
[root@localhost ~]# php -v
PHP 8.0.30 (cli) (built: Aug 3 2023 17:13:08) ( NTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.30, Copyright (c) Zend Technologies
[root@localhost ~]#
安装方法参考
二、安装MYSQL8.0以上
我这里使用mysql8.0.35
[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.35 MySQL Community Server - GPL
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
三、安装nginx或apache,
我这里使用apache,版本:2.4.6
[root@localhost ~]# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built: May 30 2023 14:01:11
[root@localhost ~]#
apache安装方法有编译安装
这里使用YUM来再安装一次
#检查旧版apche,并卸载旧版
[root@localhost ~]# rpm -qa | grep httpd
[root@localhost ~]# yum remove httpd*
[root@localhost ~]# yum install httpd
[root@localhost ~]# systemctl start httpd
# Apache配置文件:
```go
[root@localhost ~]# find / -name httpd
/run/httpd
/etc/sysconfig/httpd
/etc/logrotate.d/httpd
/etc/httpd
/var/log/httpd
/var/cache/httpd
/usr/sbin/httpd
/usr/lib64/httpd
/usr/share/httpd
/usr/libexec/initscripts/legacy-actions/httpd
/data/httpd
[root@localhost ~]#
[root@localhost ~]# find / -name httpd.conf
/etc/httpd/conf/httpd.conf
/usr/lib/tmpfiles.d/httpd.conf
[root@localhost ~]#
#开放80端口
[root@localhost ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent
success
[root@localhost ~]#
[root@localhost ~]# firewall-cmd --zone=public --add-port=443/tcp --permanent
success
[root@localhost ~]#
#检查确认是否开启
[root@localhost ~]# firewall-cmd --reload
[root@localhost ~]# firewall-cmd --list-ports
80/tcp 443/tcp
[root@localhost ~]#
[root@localhost ~]#
三、安装Nextcloud
1、
#启用Apache PHP模块
[root@localhost ~]# yum install mod_php
#vim
2、
#启用Aapache https访问模块
[root@localhost ~]# vim /etc/httpd/conf/httpd.conf
#增加与修改处
#1、DirectoryIndex处增加index.php
#
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
#2、 LoadModule 处增加
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
#3、AddType处增加
AddType application/x-httpd-php .php
AddType text/html .php
#、测试
[root@localhost ~]# echo " " > /var/www/html/index.php
[root@localhost ~]# systemctl restart httpd
[root@localhost ~]# echo " " > /var/www/html/index.php
[root@localhost ~]# systemctl restart httpd
3、创建Nextcloud目录,并下载最新Nextcloud文件到创建目录
[root@localhost ~]# mkdir -p /data/nextcloud/
[root@localhost ~]# chown -R apache. /data/nextcloud/
[root@localhost ~]# chmod -R 755 /data/nextcloud/
[root@localhost ~]# cd /data/nextcloud/
[root@localhost nextcloud]# wget https://download.nextcloud.com/server/releases/latest.zip
[root@localhost nextcloud]# ls
latest.zip
[root@localhost nextcloud]# unzip latest.zip
[root@localhost nextcloud]# ls
latest.zip nextcloud
[root@localhost nextcloud]# rm -rf latest.zip
#修改发布目录
[root@localhost html]# vim /etc/httpd/conf/httpd.conf
[root@localhost html]# systemctl restart httpd
4、创建数据库,并登录
[root@localhost ~]# mysql -uroot -p
mysql> CREATE DATABASE nextcloud;
Query OK, 1 row affected (0.01 sec)
mysql> create user 'nextcloud'@'%' identified by '123456';
Query OK, 0 rows affected (0.01 sec)
mysql> grant all privileges on nextcloud.*to 'nextcloud'@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql>
[root@localhost ~]# vim /data/nextcloud/nextcloud/config/config.php
#在Nextcloud的config.php配置文件后面添加:
'activity_expire_days' => '90', #使得MySQL数据库中oc_activity表中的数据记录只保存90天的
'memcache.local' => '\\OC\\Memcache\\Redis', #配置redis
'redis' =>
array (
'host' => 'localhost',
'port' => 6379,
),
'memcache.locking' => '\\OC\\Memcache\\Redis',
'check_for_working_wellknown_setup' => false,
'default_phone_region' => 'CN',
);
~
yum install php-imagick php-gmp php-opcache
[root@localhost ~]# vim /etc/php.ini
vim /data/nextcloud/nextcloud/config/config.php
#增加:
'default_phone_region' => 'CN',
vim /data/nextcloud/nextcloud/config/config.php
#增加:
'check_for_working_wellknown_setup' => false,
6、
这个错误大多是配置redis后出现的
检查有没有安装redis,安装后还需要安装php-redis扩展
[root@localhost ~]# yum install redis
[root@localhost ~]# systemctl start redis
[root@localhost ~]# yum install php-redis
[root@localhost ~]# yum install mod_ssl openssl
[root@localhost ~]# vim /etc/httpd/conf.d/ssl.conf
8、
点击后面查看哪些文件无效,大部份是.htaccess .user.ini 两个文件,可以重nextcloud目录重新拷贝过来
9、
[root@localhost nextcloud]# vim /etc/php.ini