Nextcloud config

Thiết lập mặc định PHP CLI cho hệ thống đồng bộ với PHP trên aapanel (Nên cài phiên bản PHP 8.3 đầu tiên khi cài aapanel)

sudo update-alternatives --install /usr/bin/php php /www/server/php/83/bin/php 100
sudo update-alternatives --set php /www/server/php/83/bin/php

Kiểm tra phiên bản PHP: php -v

Đảm bảo php dẫn đến php 8.3 của aapanel:

echo $PATH
which php
php -v

Biên dịch lại Redis:

cd /usr/local/src
git clone https://github.com/phpredis/phpredis.git
cd phpredis
phpize  # Khởi tạo build environment
./configure --with-php-config=/www/server/php/83/bin/php-config
make && make install

2. Cài đặt mbstring (Nếu chưa có)

Đối với hệ thống sử dụng apt (Debian/Ubuntu)

Chạy lệnh sau để cài đặt thư viện cần thiết:

sh
Sao chépChỉnh sửa
sudo apt install libonig-dev

Sau đó, truy cập vào thư mục PHP source code và biên dịch lại mbstring:

sh
Sao chépChỉnh sửa
cd /www/server/php/83/src/ext/mbstring /www/server/php/83/bin/phpize ./configure --with-php-config=/www/server/php/83/bin/php-config make && make install

Kích hoạt mbstring trong php cli:

/www/server/php/83/etc/php-cli.ini

Cron mặc định hệ thống:

sudo -u www php /www/wwwroot/cloud.leographer.com/cron.php

Cron auto fix hàng tuần:

sudo -u www php /www/wwwroot/cloud.leographer.com/occ maintenance:repair

Xóa dòng cảnh báo occ bằng lệnh cron:

sudo -u www php /www/wwwroot/cloud.leographer.com/occ maintenance:repair --include-expensive

disabled functions php:

proc_open, popen, exec, putenv

opcache.memory_consumption = 512MB

---------------------------

Fix OpenLiteSpeed: /usr/local/lsws/conf/mime.properties ->

wasm    = application/wasm
tflite  = application/octet-stream
mjs     = application/javascript
heic    = image/heic
heif    = image/heif
tiff    = image/tiff
xbm     = image/x-xbitmap

#include /www/server/panel/vhost/openlitespeed/*.conf
#include /www/server/panel/vhost/openlitespeed/listen/*.conf

-----------------

Cài ffmpeg

-----------------

Config.php

  'default_phone_region' => 'VN',
  'default_language' => 'vi',
  'default_locale' => 'vi_VN',
  'maintenance_window_start' => 1,
  'defaultapp' => '',
  'twofactor_enforced' => 'true',
  'twofactor_enforced_groups' => 
  array (
    0 => 'admin',
  ),
  'twofactor_enforced_excluded_groups' => 
  array (
  ),
  'skeletondirectory' => '',
  'maintenance' => false,
  'config_is_read_only' => false,
  'theme' => '',
  'loglevel' => 2,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'localhost',
    'port' => 6379,
    'timeout' => 0.0,
    'dbindex' => 8,
    'password' => '',
  ),
  'updater.release.channel' => 'stable',
  'app_install_overwrite' => 
  array (
    0 => 'onlyoffice',
  ),
  'overwriteprotocol' => 'https',
  'forwarded_for_headers' => 
  array (
    0 => 'HTTP_X_FORWARDED',
    1 => 'HTTP_FORWARDED_FOR',
  ),
  'preview_libreoffice_path' => '/usr/bin/libreoffice',
  'enable_previews' => true,
  'preview_max_x' => 2048,
  'preview_max_y' => 2048,
  'preview_max_scale_factor' => 1,
  'enabledPreviewProviders' => array (
    'OC\\Preview\\Movie',
    'OC\\Preview\\MP4',
    'OC\\Preview\\AVI',
    'OC\\Preview\\MKV',
    'OC\\Preview\\TS',
  ),

-------------------

Cách bật HSTS trên Cloudflare

  1. Đăng nhập Cloudflare:
    👉 https://dash.cloudflare.com/

  2. Chọn tên miền cloud.leographer.com.

  3. Vào tab SSL/TLS > Chọn Edge Certificates.

  4. Cuộn xuống phần HTTP Strict Transport Security (HSTS).

  5. Nhấn Enable HSTS và chọn:

    • Max Age: 15552000 (6 tháng)
    • Include subdomains: ✅ (Tùy chọn)
    • Preload: ✅ (Tùy chọn, nếu bạn muốn đưa vào danh sách preload của Chrome)
    • No-Sniff Header: ✅ (Khuyến nghị)
  6. Nhấn Save để lưu.

https://help.nextcloud.com/t/high-performance-backend-for-talk-on-nextcloud-with-docker/215828

------------------------

Bypass cache trên cloudflare

cloud.domain.com/*

Cache Level: Bypass

Cấu hình extension=mbstring
extension=mbstring.so

Did you find this article useful?