root@ykla:/usr/ports/www/nextcloud# php -vPHP8.2.25 (cli) (built:Nov1202413:10:16) (NTS)Copyright (c) The PHP GroupZendEnginev4.2.25,Copyright (c) Zend TechnologieswithZendOPcachev8.2.25,Copyright (c), by Zend Technologiesroot@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_php82mod_php82-8.2.25:Oninstall:******************************************************************************Considerswitchingtophp-fpmandmod_fast_cgiasperApachehttpdprojectrecommendation.Seehttps://cwiki.apache.org/confluence/display/HTTPD/PHP-FPM******************************************************************************IfyouarebuildingPHP-basedportsinpoudriere(8) orSynthwithZTSenabled,addWITH_MPM=eventto/etc/make.conftopreventbuildfailures.******************************************************************************Makesureindex.phpispartofyourDirectoryIndex.YoushouldaddthefollowingtoyourApacheconfigurationfile:<FilesMatch "\.php$">SetHandlerapplication/x-httpd-php</FilesMatch><FilesMatch "\.phps$">SetHandlerapplication/x-httpd-php-source</FilesMatch>******************************************************************************
root@ykla:/usr/ports/www/nextcloud# pkg info -D nextcloud-php82nextcloud-php82-30.0.1:Oninstall:/!\TheFreeBSDpackageREQUIREStheapps_pathsconfigurationas/!\/!\ seen inconfig/config.sample.phptofunction/!\Please notethateverythinghasbeeninstalledin/usr/local/www/nextcloud.Youwillprobablywanttoaddanaliastoyourhttpd.conffile,somethinglikethis:Alias/nextcloud/usr/local/www/nextcloudAcceptPathInfoOn<Directory/usr/local/www/nextcloud>AllowOverrideAllRequireallgranted</Directory>AndrestartApache.Nextcloudwillstartthebundledinstalleronfirstaccess.Oncethebundledinstallerfinishes,furtherconfigurationcanbedonevia'Settings','Administration'.Additionalconfigurationoptionsareavailablein/usr/local/www/nextcloud/config/config.phpYoucanfindannotatedconfigurationoptionsinconfig.documented.phpin the same directory. Nextcloud's configuration documentation is at https://docs.nextcloud.com/server/stable/admin_manual/configuration_serverThe caching options require additional Nextcloud configuration.On upgrade:After a version migration you should upgrade your nextcloud instanceusing command line: occ upgradeMerge any changes to /usr/local/www/nextcloud/.htaccess.dist into .htaccess (above the'#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####' divider if it exists)andupdatethedynamicpartofthefileusingthecommandline:occmaintenance:update:htaccessAsofNextcloud27.1.0therecommendedPHPversionis8.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>