This version of Nextcloud is not compatible with PHP>=8.4.
You are currently running 8.4.0RC3.
故,为了方便安装,请使用 Ports 而非 pkg:
# cd /usr/ports/www/nextcloud/
# make config # 为了方便,仅配置 nextcloud 本体
本文选中 PGSQL,SMB,PCNTL;取消勾选 MYSQL:
编译安装:
# make BATCH=yes install clean
安装配置 PostgreSQL
安装(请留意上面 ports 默认安装的 postgresql-client 版本,尽量一致)
# pkg install postgresql16-server
或者:
# cd /usr/ports/databases/postgresql16-server/
# make install clean
配置:
# sysrc postgresql_enable=YES
root@ykla:/usr/ports/www/nextcloud # su - postgres #切换到数据库用户
$ /usr/local/bin/pg_ctl -D /var/db/postgres/data16/ -l logfile start # 初始化
waiting for server to start.... done
server started
$ psql -Upostgres # 进入命令模式
psql (16.4)
Type "help" for help.
postgres=# create user nextcloud; # 创建所需用户
CREATE ROLE
postgres=# \password nextcloud # 创建用户 nextcloud 密码,注意斜杠要输入:\
Enter new password for user "nextcloud": # 此处输入密码,密码不会显示到屏幕上,也不是 *,就是空的,下同
Enter it again: # 再次重复输入上面密码
postgres=# create database nextcloud owner=nextcloud; # 创建所需数据库的属主
CREATE DATABASE
postgres-# \q # 退出,注意斜杠要输入:\
root@ykla:/usr/ports/www/nextcloud # php -v
PHP 8.2.25 (cli) (built: Nov 1 2024 13:10:16) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.25, Copyright (c) Zend Technologies
with Zend OPcache v8.2.25, Copyright (c), by Zend Technologies
root@ykla:/usr/ports/www/nextcloud #
# pkg install mod_php82
安装 Apache
# pkg install apache24
或者
# cd /usr/ports/www/apache24/
# make install clean
配置服务:
# sysrc apache24_enable=yes
查看 Apache 配置方法
root@ykla:/usr/ports/www/nextcloud # pkg info -D mod_php82
mod_php82-8.2.25:
On install:
******************************************************************************
Consider switching to php-fpm and mod_fast_cgi as per Apache httpd project
recommendation. See https://cwiki.apache.org/confluence/display/HTTPD/PHP-FPM
******************************************************************************
If you are building PHP-based ports in poudriere(8) or Synth with ZTS enabled,
add WITH_MPM=event to /etc/make.conf to prevent build failures.
******************************************************************************
Make sure index.php is part of your DirectoryIndex.
You should add the following to your Apache configuration file:
<FilesMatch "\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
******************************************************************************
root@ykla:/usr/ports/www/nextcloud # pkg info -D nextcloud-php82
nextcloud-php82-30.0.1:
On install:
/!\ The FreeBSD package REQUIRES the apps_paths configuration as /!\
/!\ seen in config/config.sample.php to function /!\
Please note that everything has been installed in /usr/local/www/nextcloud.
You will probably want to add an alias to your httpd.conf file,
something like this:
Alias /nextcloud /usr/local/www/nextcloud
AcceptPathInfo On
<Directory /usr/local/www/nextcloud>
AllowOverride All
Require all granted
</Directory>
And restart Apache. Nextcloud will start the bundled installer on first
access. Once the bundled installer finishes, further configuration can
be done via 'Settings', 'Administration'. Additional configuration
options are available in
/usr/local/www/nextcloud/config/config.php
You can find annotated configuration options in config.documented.php
in the same directory. Nextcloud's configuration documentation is at
https://docs.nextcloud.com/server/stable/admin_manual/configuration_server
The caching options require additional Nextcloud configuration.
On upgrade:
After a version migration you should upgrade your nextcloud instance
using command line:
occ upgrade
Merge any changes to /usr/local/www/nextcloud/.htaccess.dist into .htaccess (above the
'#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####' divider if it exists)
and update the dynamic part of the file using the commandline:
occ maintenance:update:htaccess
As of Nextcloud 27.1.0 the recommended PHP version is 8.2.
编辑 /usr/local/etc/apache24/httpd.conf,加入:
<FilesMatch "\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
Alias /nextcloud /usr/local/www/nextcloud
AcceptPathInfo On
<Directory /usr/local/www/nextcloud>
AllowOverride All
Require all granted
</Directory>