nextcloud
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]
開始行:
[[LinuxServer]]
#shadowheader(1,"nextcloud");
#contents
* 初回設定、参考サイト [#p3618aa5]
-このサイトが一番わかりやすそうかな。。。~
自分は既存の環境(LAMP)にインストール、設定しました。
--[[NextCloud : インストール:https://www.server-world.inf...
* rsyslogのインストール [#n2a6b87d]
sudo apt install rsyslog
* Log出力設定の変更 [#ie24b2e0]
** 参考サイト [#we05392c]
-[[【techblog】Nextcloudの管理用CLI「occ」詳細: ログ管理...
** ログの出力、確認 [#gda26f11]
php (nextCloudのルートフォルダ)/occ log:file
** ログの出力方式変更 [#l736066e]
php (nextCloudのルートフォルダ)/occ log:manage --level=i...
* Install後のセキュリティ&セットアップ警告 [#yd6b5317]
-&color(red,){''自分の環境に特化した内容が含まれますので...
** 「.soファイル」のコピー先の確認方法 [#f9eea653]
-phpinfo で「extension_dir」を確認
** OPcache [#g37d322d]
*** Install [#p20b5ae0]
sudo yum install php74-php-opcache php74-php-pecl-apcu
*** 必要なファイルをApacheが参照しているディレクトリへコ...
+必要なファイルの検索1
find /opt -name "*opcache*"
+必要なファイルの検索2
find /etc -name "*opcache*"
+ファイルのコピー
sudo cp /etc/opt/remi/php74/php.d/10-opcache.ini /etc/ph...
sudo cp /opt/remi/php74/root/usr/lib64/php/modules/opcac...
*** 設定変更 [#m6fa9c49]
+sudo vim /etc/php.d/10-opcache.ini
zend_extension=opcache
opcache.enable=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq = 60
opcache.validate_timestamps = 0
***確認 [#o892298a]
+php -v
++結果例
PHP 7.4.33 (cli) (built: Apr 10 2024 09:34:29) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.33, Copyright (c), by Zend Te...
+phpinfoにも「Zend OPcache」の項目として出てきます
** APCu [#h69a73a4]
*** Install [#i8258739]
sudo yum install php74-php-pecl-apcu
*** 必要なファイルをApacheが参照しているディレクトリへコ...
+必要なファイルの検索1
find /opt -name "*apcu*"
+必要なファイルの検索2
find /etc -name "*apcu*"
+ファイルのコピー
sudo cp /etc/opt/remi/php74/php.d/40-apcu.ini /etc/php.d/
sudo cp /opt/remi/php74/root/usr/lib64/php/modules/apcu....
*** 設定変更 [#vfc31d5b]
+sudo vim (nextCloudのルートフォルダ)/config/config.php
--「'memcache.local' => '\OC\Memcache\APCu',」を追加
'installed' => true, ...
'default_phone_region' => 'JP', ...
'memcache.local' => '\OC\Memcache\APCu', ...
'memcache.distributed' => '\OC\Memcache\Redis', ...
'memcache.locking' => '\OC\Memcache\Redis', ...
'redis' => [ ...
'host' => 'localhost', ...
'port' => 6379, ...
], ...
);
***確認 [#pe9ef05a]
+httpdを再起動
sudo systemctl restart httpd
+phpinfoに「apcu」の項目として出てきます。
** redis [#z0120fd3]
*** Install [#e2a8ffa9]
sudo yum install php74-php-pecl-redis
*** 必要なファイルをApacheが参照しているディレクトリへコ...
+redis関連
++必要なファイルの検索1
find /opt -name "*redis.so*"
++必要なファイルの検索2
find /etc -name "*redis*"
++ファイルのコピー
sudo cp /etc/opt/remi/php74/php.d/50-redis.ini /etc/php.d/
sudo cp /opt/remi/php74/root/usr/lib64/php/modules/redis...
+igbinary.so
++必要なファイルの検索1
find /opt -name "*igbinary*"
++必要なファイルの検索2
find /etc -name "*igbinary*"
++ファイルのコピー
sudo cp /etc/opt/remi/php74/php.d/40-igbinary.ini /etc/p...
sudo cp /opt/remi/php74/root/usr/lib64/php/modules/igbin...
+msgpack.so
++必要なファイルの検索1
find /opt -name "*msgpack*"
++必要なファイルの検索2
find /etc -name "*msgpack*"
++ファイルのコピー
sudo cp /etc/opt/remi/php74/php.d/40-msgpack.ini /etc/ph...
sudo cp /opt/remi/php74/root/usr/lib64/php/modules/msgpa...
*** 設定変更 [#xbc91c06]
+sudo vim (nextCloudのルートフォルダ)/config/config.php
--「'memcache.distributed' => '\OC\Memcache\Redis',」以下...
'installed' => true,
'default_phone_region' => 'JP',
'memcache.local' => '\OC\Memcache\APCu',
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => [
'host' => 'localhost',
'port' => 6379,
],
);
***確認 [#g53e5f09]
+httpdを再起動
sudo systemctl restart httpd
+phpinfoに「redis」の項目として出てきます。
** OPcacheのインターン化文字列バッファーがまもなく一杯に...
-sudo vim /etc/php.d/10-opcache.ini
opcache.interned_strings_buffer=32
-restart httpd
sudo systemctl restart httpd
** php-fpm のチューニング [#ad171cf5]
- [[参考サイト(nextcloudが速くなるチューニングポイント):h...
- sudo vim /etc/php/8.2/fpm/pool.d/www.conf
- 設定値参考
pm = static
pm.max_children = 120
pm.start_servers = 12
pm.min_spare_servers = 6
pm.max_spare_servers = 18
* 全文検索機能を組み込む(elasticsearch,Full text search) ...
** 環境 [#dd9b58d6]
-NextCloud純正のVMイメージから仮想マシンを作ってます。~
elasticsearchはNextCloudのサーバに同居させてます。
|debian|12.9|
|nextcloud|Nextcloud Hub 9 (30.0.6)|
|elasticsearch|Version: 8.17.2, Build: deb/747663ddda3421...
|java|openjdk version "17.0.14" 2025-01-21&br;OpenJDK Run...
** elasticsearchサーバの構築 [#gc64b426]
*** install [#if1ec6eb]
+レポジトリkeyのインストール
wget https://artifacts.elastic.co/GPG-KEY-elasticsearch ...
echo "deb [signed-by=/etc/apt/keyrings/GPG-KEY-elasticse...
+関連パッケージのインストール(ただあとでsslは無効化するの...
sudo apt-get install apt-transport-https
+install
sudo apt update
apt -y install elasticsearch
+アナライザ トークナイザ、「analysis-kuromoji」のインスト...
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin i...
*** メモリ関連の設定 [#qf100bdf]
sudo vim /etc/elasticsearch/jvm.options
+以下を追加(値は各自のサーバ状況に合わせて下さい)
########################################################...
## IMPORTANT: JVM heap size
########################################################...
##
## The heap size is automatically configured by Elastics...
## based on the available memory in your system and the ...
## each node is configured to fulfill. If specifying hea...
## required, it should be done through a file in jvm.opt...
## which should be named with .options suffix, and the m...
## max should be set to the same value. For example, to ...
## heap to 4 GB, create a new file in the jvm.options.d
## directory containing these lines:
##
## -Xms4g
## -Xmx4g
##
## See https://www.elastic.co/guide/en/elasticsearch/ref...
## for more information
##
########################################################...
-Xms1g
-Xmx2g
*** sslの無効化 [#x6826800]
sudo vim /etc/elasticsearch/elasticsearch.yml
# Enable security features
#xpack.security.enabled: true
xpack.security.enabled: false
#xpack.security.enrollment.enabled: true
xpack.security.enrollment.enabled: false
# Enable encryption for HTTP API client connections, suc...
#xpack.security.http.ssl:
# enabled: true
# keystore.path: certs/http.p12
#
xpack.security.http.ssl:
enabled: false
# keystore.path: certs/http.p12
# Enable encryption and mutual authentication between cl...
#xpack.security.transport.ssl:
# enabled: true
# verification_mode: certificate
# keystore.path: certs/transport.p12
# truststore.path: certs/transport.p12
xpack.security.transport.ssl:
enabled: false
# verification_mode: certificate
# keystore.path: certs/transport.p12
# truststore.path: certs/transport.p12
# Create a new cluster with the current node only
# Additional nodes can still join the cluster later
cluster.initial_master_nodes: ["serverName"]
# Allow HTTP API connections from anywhere
# Connections are encrypted and require user authenticat...
http.host: 0.0.0.0
# Allow other nodes to join the cluster from anywhere
# Connections are encrypted and mutually authenticated
#transport.host: 0.0.0.0
#----------------------- END SECURITY AUTO CONFIGURATION...
*** elasticsearchデーモンの起動と自動起動設定 [#m144ae35]
sudo systemctl restart elasticsearch
sudo systemctl enable elasticsearch
*** 動作確認 [#d40e98d3]
+なんかしら帰ってきます。ブラウザでも確認可能。
curl http://localhost:9200
** nextcloud側の設定 [#k91666f3]
*** 関連アプリのインストール [#ff580305]
+右上のイニシャルボタンから「アプリ」を選択
--&imgr(./image/nextCloud/nextCloudApp01.png,100%);
+左側の「ダッシュボード」を選択し、上の検索から「full tex...
下の画像の3つを有効にしてインストールします。
--&imgr(./image/nextCloud/nextCloudApp02.png,100%);
*** 設定 [#a6d7c376]
+右上のイニシャル・アイコンから「管理者設定」を選択
--&imgr(./image/nextCloud/nextCloudApp03.png,100%);
+左側から全文検索を選択
--&imgr(./image/nextCloud/nextCloudApp04.png,100%);
+設定イメージ
--&imgr(./image/nextCloud/nextCloudApp05.png,100%);
--&imgr(./image/nextCloud/nextCloudApp06.png,100%);
+設定値(コピペできるように)
--http://localhost:9200/
--nextcloud
---これ、はまりました。。。この文字列でないとelasticsearc...
--analysis-kuromoji
** 全文検索、index作成テストと作成 [#n74b0712]
-occ は、/var/www/nextcloud/occ かもしれない。
sudo -u www-data php occ fulltextsearch:check
sudo -u www-data php occ fulltextsearch:test
-indexの作成
sudo -u www-data php occ fulltextsearch:index
-エラー数をリセットしたい場合
sudo -u www-data php occ fulltextsearch:index "{\"errors...
** daemon化 [#i6dcb3c9]
*** scriptの作成 [#ud6b6f62]
+sudo vi /usr/local/bin/nextCloudFullTextSearch.sh
#!/bin/sh
# Quick start-stop-daemon example, derived from Debian /...
set -e
# Must be a valid filename
NAME=fulltextsearch-daemon
PIDFILE=/var/run/$NAME.pid
#This is the command to be run, give the full pathname
DAEMON="/usr/bin/php"
DAEMON_OPTS="/var/www/nextcloud/occ fulltextsearch:live"
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
case "$1" in
start)
echo -n "Starting daemon: "$NAME
start-stop-daemon --start --background --quiet -...
echo "."
;;
stop)
echo -n "Stopping daemon: "$NAME
start-stop-daemon --stop --quiet --oknodo --pidf...
echo "."
;;
restart)
echo -n "Restarting daemon: "$NAME
start-stop-daemon --stop --quiet --oknodo --retr...
start-stop-daemon --start --background --quiet -...
echo "."
;;
*)
echo "Usage: "$1" {start|stop|restart}"
exit 1
esac
exit 0
+実行権限の追加
sudo chmod +x /usr/local/bin/nextCloudFullTextSearch.sh
*** systemctlへ登録 [#kb68eec9]
- [[参考サイト1(systemdの.serviceファイルで、実行ユーザー...
- [[参考サイト2(systemd のユニットファイルの作り方):https...
+ sudo vi /etc/systemd/system/nextCloudFullTextSearch.ser...
[Unit]
Description = nextCloudFullTextSearch
[Service]
Restart = no
Type = forking
User=www-data
Group=www-data
ExecStart = /usr/local/bin/nextCloudFullTextSearch.sh st...
ExecReload = /usr/local/bin/nextCloudFullTextSearch.sh r...
ExecStop = /usr/local/bin/nextCloudFullTextSearch.sh stop
[Install]
WantedBy = multi-user.target
+ 登録できたか確認
sudo systemctl list-unit-files --type=service | grep next
+ maskの解除
sudo systemctl unmask nextCloudFullTextSearch.service
-- 何故か上記のファイルが消えたので再度作成
*** 起動と自動起動化 [#o3c8d902]
sudo systemctl enable nextCloudFullTextSearch.service
sudo systemctl restart nextCloudFullTextSearch.service
*** 実行されているか確認 [#o1b541ba]
- ps ax | grep occ
** エラー対応 [#rb73b766]
*** Testing search platform. fail [#q498f982]
-エラー内容
$ sudo docker exec --user www-data nextcloud php occ ful...
.Testing your current setup:
Creating mocked content provider. ok
Testing mocked provider: get indexable documents. (2 ite...
Loading search platform. (Elasticsearch) ok
Testing search platform. fail
.Testing your current setup:
Creating mocked content provider. ok
Testing mocked provider: get indexable documents. (2 ite...
Loading search platform. (Elasticsearch) ok
Testing search platform. fail
-原因
--多分、ssl関連
-対策
--elasticsearchの非ssl化(https -> http)
*** retrieving content from a big index (license). fail [...
-原因
--「インデックス,インデックスの名前」が間違えている
-- &imgr(./image/nextCloud/nextCloudApp07.png,100%);
-対策
-- インデックス名を正しい文字列へ
-- NextCloud -> &br; -> 右上(イニシャル・アイコン)から「...
* その他 [#a7b320c1]
** sessionディレクトリへ権限追加 [#z716795d]
-参考サイト[[【Nextcloud】ログインループ (3) -アッサリ解...
*** sessionディレクトリの確認 [#k4f34570]
-phpinfo()で確認する
<?php
phpinfo();
?>
*** sessionディレクトリへアクセス兼を設定 [#u0bacdbf]
sudo chown apache: -R /var/lib/php/session
** パスワード・リセット [#l342e888]
sudo -u www-data php /var/www/nextcloud/occ user:resetpa...
** WebDav [#xf4dde6b]
*** WindowsのExplorer(エクスプローラー)でマウント [#g4393...
-なんとなくできなくなった?あるいはできなくなる?
--[[Microsoft、WebDAVを含む3つの機能をWindowsから非推奨へ...
-[[参考サイト:https://qiita.com/legitwhiz/items/9ec7d6728...
*** サードパーティのWebDavクライアントソフトを使います。 ...
-[[WebDavクライアントのまとめサイト:https://www.nminoru.j...
-- 個人的には「RaiDrive」が良いかな、と思いました。
--- [[RaiDrive download site:https://www.raidrive.com/dow...
** Apache実行ユーザーの変更 [#u3efce90]
***ログインできない [#w8acd740]
-大体、sessionフォルダへのアクセス権の問題
sudo chown apacheUser:ApacheUsers /var/lib/php/sessions -R
*** redis エラー [#m1c11177]
-redis グループへApache2実行ユーザーを追加
sudo gpasswd -a apacheUser redis
-daemon再起動
systemctl restart redis
systemctl restart apache2
***cron実行ユーザーの変更 [#u5ae7346]
- sudo vim /etc/cron.d/nextcloud
** 詳細ログ(ログイン、ログオフなど)の記録 [#pc5e887a]
+NextCloudへ「Auditing / Logging」アプリのインストール
+ログレベルを1(info)へ変更
-- sudo vi /var/www/nextcloud/config/config.php
'log_type' => 'file',
'logfile' => '/var/www/nextcloud-data/nextcloud.log',
'loglevel' => 1,
+以下のディレクトリ内、2つのファイルに記録される
/var/www/nextcloud-data/nextcloud.log
/var/www/nextcloud-data/audit.log
** upgrade後のレストア(restore)、バックアップから戻す [#b...
*** 参考サイト(公式) [#m7e339db]
-[[Restoring backup:https://docs.nextcloud.com/server/la...
*** restoreコマンド例 [#z9a3e831]
+最初にメンテンスモードをオン
sudo vi /var/www/nextcloud/config/config.php
'maintenance' => true,
+rsyncコマンドでバックップディレクトリからコピーする。
sudo rsync -Aaxv /var/www/nextcloud-data/updater-563ec6d...
+メンテナンス・モードをオフ
sudo vi /var/www/nextcloud/config/config.php
'maintenance' => false
+apache2のリスタート
systemctl restart apache2
** NextCloudクライアント(Windows)、仮想ファイルのローカル...
+以下のファイルを編集
%appdata%\nextcloud\nextcloud.cfg
+以下の場所を変更~
(フォルダのデリミッタはスラッシュなので注意。~
バックスラッシュ(\)ではない)
0\FoldersWithPlaceholders\1\localPath
--例
0\FoldersWithPlaceholders\1\localPath=D:/nextCloud
* エラー対処 [#g0b254b3]
** 参考サイト [#a7bad03f]
-[[Linuxで様々なサービスを構築しよう!!!:https://www.bi...
** cron.phpが実行されない [#g5e94c4d]
-以下に変更(/dev/null 2>&1を消し、apc.enable を追加)
-sudo vim /etc/cron.d/nextcloud
/usr/bin/php -f /var/www/nextcloud/cron.php --define apc...
-設定変更後は少し時間がかかる事がありますが、何回か実行し...
-実行されているかの確認は、NextCloudの「管理者設定」->「...
** updateに失敗する(create backup failed) [#c9e0f87d]
+最初に「対応バージョンがないアプリ」を確認。対応してない...
+以下のコマンドで確認
sudo -u www-data php --define apc.enable_cli=1 /var/www/...
+バックアップの失敗はpermissionエラーの場合が多い。~
以下のコマンドを実行
sudo chown www-data:www-data -R /var/www/nextcloud/*
** メンタンス・モード(Maintenanceモード)が解除されない。 ...
+以下のファイルを編集
sudo vim /var/www/nextcloud/config/config.php
+以下の場所
'maintenance' => false,
** Downgrading is not supported and is likely to cause un...
+apacheの再起動
sudo systemctl restart apache2
** 同期エラーで修正しようとしても「ローカルファイルコピー...
+NextCloud側にゴミが残っているので、ブラウザでNextCloudに...
(F5キーなど最新の情報に更新するのを忘れずに。。。)
** Windows用, NextCloud ファイル・クライアントで VCOMP140...
+以下をインストール
--[[Visual C++ Redistributable for Visual Studio 2015:htt...
終了行:
[[LinuxServer]]
#shadowheader(1,"nextcloud");
#contents
* 初回設定、参考サイト [#p3618aa5]
-このサイトが一番わかりやすそうかな。。。~
自分は既存の環境(LAMP)にインストール、設定しました。
--[[NextCloud : インストール:https://www.server-world.inf...
* rsyslogのインストール [#n2a6b87d]
sudo apt install rsyslog
* Log出力設定の変更 [#ie24b2e0]
** 参考サイト [#we05392c]
-[[【techblog】Nextcloudの管理用CLI「occ」詳細: ログ管理...
** ログの出力、確認 [#gda26f11]
php (nextCloudのルートフォルダ)/occ log:file
** ログの出力方式変更 [#l736066e]
php (nextCloudのルートフォルダ)/occ log:manage --level=i...
* Install後のセキュリティ&セットアップ警告 [#yd6b5317]
-&color(red,){''自分の環境に特化した内容が含まれますので...
** 「.soファイル」のコピー先の確認方法 [#f9eea653]
-phpinfo で「extension_dir」を確認
** OPcache [#g37d322d]
*** Install [#p20b5ae0]
sudo yum install php74-php-opcache php74-php-pecl-apcu
*** 必要なファイルをApacheが参照しているディレクトリへコ...
+必要なファイルの検索1
find /opt -name "*opcache*"
+必要なファイルの検索2
find /etc -name "*opcache*"
+ファイルのコピー
sudo cp /etc/opt/remi/php74/php.d/10-opcache.ini /etc/ph...
sudo cp /opt/remi/php74/root/usr/lib64/php/modules/opcac...
*** 設定変更 [#m6fa9c49]
+sudo vim /etc/php.d/10-opcache.ini
zend_extension=opcache
opcache.enable=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq = 60
opcache.validate_timestamps = 0
***確認 [#o892298a]
+php -v
++結果例
PHP 7.4.33 (cli) (built: Apr 10 2024 09:34:29) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.33, Copyright (c), by Zend Te...
+phpinfoにも「Zend OPcache」の項目として出てきます
** APCu [#h69a73a4]
*** Install [#i8258739]
sudo yum install php74-php-pecl-apcu
*** 必要なファイルをApacheが参照しているディレクトリへコ...
+必要なファイルの検索1
find /opt -name "*apcu*"
+必要なファイルの検索2
find /etc -name "*apcu*"
+ファイルのコピー
sudo cp /etc/opt/remi/php74/php.d/40-apcu.ini /etc/php.d/
sudo cp /opt/remi/php74/root/usr/lib64/php/modules/apcu....
*** 設定変更 [#vfc31d5b]
+sudo vim (nextCloudのルートフォルダ)/config/config.php
--「'memcache.local' => '\OC\Memcache\APCu',」を追加
'installed' => true, ...
'default_phone_region' => 'JP', ...
'memcache.local' => '\OC\Memcache\APCu', ...
'memcache.distributed' => '\OC\Memcache\Redis', ...
'memcache.locking' => '\OC\Memcache\Redis', ...
'redis' => [ ...
'host' => 'localhost', ...
'port' => 6379, ...
], ...
);
***確認 [#pe9ef05a]
+httpdを再起動
sudo systemctl restart httpd
+phpinfoに「apcu」の項目として出てきます。
** redis [#z0120fd3]
*** Install [#e2a8ffa9]
sudo yum install php74-php-pecl-redis
*** 必要なファイルをApacheが参照しているディレクトリへコ...
+redis関連
++必要なファイルの検索1
find /opt -name "*redis.so*"
++必要なファイルの検索2
find /etc -name "*redis*"
++ファイルのコピー
sudo cp /etc/opt/remi/php74/php.d/50-redis.ini /etc/php.d/
sudo cp /opt/remi/php74/root/usr/lib64/php/modules/redis...
+igbinary.so
++必要なファイルの検索1
find /opt -name "*igbinary*"
++必要なファイルの検索2
find /etc -name "*igbinary*"
++ファイルのコピー
sudo cp /etc/opt/remi/php74/php.d/40-igbinary.ini /etc/p...
sudo cp /opt/remi/php74/root/usr/lib64/php/modules/igbin...
+msgpack.so
++必要なファイルの検索1
find /opt -name "*msgpack*"
++必要なファイルの検索2
find /etc -name "*msgpack*"
++ファイルのコピー
sudo cp /etc/opt/remi/php74/php.d/40-msgpack.ini /etc/ph...
sudo cp /opt/remi/php74/root/usr/lib64/php/modules/msgpa...
*** 設定変更 [#xbc91c06]
+sudo vim (nextCloudのルートフォルダ)/config/config.php
--「'memcache.distributed' => '\OC\Memcache\Redis',」以下...
'installed' => true,
'default_phone_region' => 'JP',
'memcache.local' => '\OC\Memcache\APCu',
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => [
'host' => 'localhost',
'port' => 6379,
],
);
***確認 [#g53e5f09]
+httpdを再起動
sudo systemctl restart httpd
+phpinfoに「redis」の項目として出てきます。
** OPcacheのインターン化文字列バッファーがまもなく一杯に...
-sudo vim /etc/php.d/10-opcache.ini
opcache.interned_strings_buffer=32
-restart httpd
sudo systemctl restart httpd
** php-fpm のチューニング [#ad171cf5]
- [[参考サイト(nextcloudが速くなるチューニングポイント):h...
- sudo vim /etc/php/8.2/fpm/pool.d/www.conf
- 設定値参考
pm = static
pm.max_children = 120
pm.start_servers = 12
pm.min_spare_servers = 6
pm.max_spare_servers = 18
* 全文検索機能を組み込む(elasticsearch,Full text search) ...
** 環境 [#dd9b58d6]
-NextCloud純正のVMイメージから仮想マシンを作ってます。~
elasticsearchはNextCloudのサーバに同居させてます。
|debian|12.9|
|nextcloud|Nextcloud Hub 9 (30.0.6)|
|elasticsearch|Version: 8.17.2, Build: deb/747663ddda3421...
|java|openjdk version "17.0.14" 2025-01-21&br;OpenJDK Run...
** elasticsearchサーバの構築 [#gc64b426]
*** install [#if1ec6eb]
+レポジトリkeyのインストール
wget https://artifacts.elastic.co/GPG-KEY-elasticsearch ...
echo "deb [signed-by=/etc/apt/keyrings/GPG-KEY-elasticse...
+関連パッケージのインストール(ただあとでsslは無効化するの...
sudo apt-get install apt-transport-https
+install
sudo apt update
apt -y install elasticsearch
+アナライザ トークナイザ、「analysis-kuromoji」のインスト...
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin i...
*** メモリ関連の設定 [#qf100bdf]
sudo vim /etc/elasticsearch/jvm.options
+以下を追加(値は各自のサーバ状況に合わせて下さい)
########################################################...
## IMPORTANT: JVM heap size
########################################################...
##
## The heap size is automatically configured by Elastics...
## based on the available memory in your system and the ...
## each node is configured to fulfill. If specifying hea...
## required, it should be done through a file in jvm.opt...
## which should be named with .options suffix, and the m...
## max should be set to the same value. For example, to ...
## heap to 4 GB, create a new file in the jvm.options.d
## directory containing these lines:
##
## -Xms4g
## -Xmx4g
##
## See https://www.elastic.co/guide/en/elasticsearch/ref...
## for more information
##
########################################################...
-Xms1g
-Xmx2g
*** sslの無効化 [#x6826800]
sudo vim /etc/elasticsearch/elasticsearch.yml
# Enable security features
#xpack.security.enabled: true
xpack.security.enabled: false
#xpack.security.enrollment.enabled: true
xpack.security.enrollment.enabled: false
# Enable encryption for HTTP API client connections, suc...
#xpack.security.http.ssl:
# enabled: true
# keystore.path: certs/http.p12
#
xpack.security.http.ssl:
enabled: false
# keystore.path: certs/http.p12
# Enable encryption and mutual authentication between cl...
#xpack.security.transport.ssl:
# enabled: true
# verification_mode: certificate
# keystore.path: certs/transport.p12
# truststore.path: certs/transport.p12
xpack.security.transport.ssl:
enabled: false
# verification_mode: certificate
# keystore.path: certs/transport.p12
# truststore.path: certs/transport.p12
# Create a new cluster with the current node only
# Additional nodes can still join the cluster later
cluster.initial_master_nodes: ["serverName"]
# Allow HTTP API connections from anywhere
# Connections are encrypted and require user authenticat...
http.host: 0.0.0.0
# Allow other nodes to join the cluster from anywhere
# Connections are encrypted and mutually authenticated
#transport.host: 0.0.0.0
#----------------------- END SECURITY AUTO CONFIGURATION...
*** elasticsearchデーモンの起動と自動起動設定 [#m144ae35]
sudo systemctl restart elasticsearch
sudo systemctl enable elasticsearch
*** 動作確認 [#d40e98d3]
+なんかしら帰ってきます。ブラウザでも確認可能。
curl http://localhost:9200
** nextcloud側の設定 [#k91666f3]
*** 関連アプリのインストール [#ff580305]
+右上のイニシャルボタンから「アプリ」を選択
--&imgr(./image/nextCloud/nextCloudApp01.png,100%);
+左側の「ダッシュボード」を選択し、上の検索から「full tex...
下の画像の3つを有効にしてインストールします。
--&imgr(./image/nextCloud/nextCloudApp02.png,100%);
*** 設定 [#a6d7c376]
+右上のイニシャル・アイコンから「管理者設定」を選択
--&imgr(./image/nextCloud/nextCloudApp03.png,100%);
+左側から全文検索を選択
--&imgr(./image/nextCloud/nextCloudApp04.png,100%);
+設定イメージ
--&imgr(./image/nextCloud/nextCloudApp05.png,100%);
--&imgr(./image/nextCloud/nextCloudApp06.png,100%);
+設定値(コピペできるように)
--http://localhost:9200/
--nextcloud
---これ、はまりました。。。この文字列でないとelasticsearc...
--analysis-kuromoji
** 全文検索、index作成テストと作成 [#n74b0712]
-occ は、/var/www/nextcloud/occ かもしれない。
sudo -u www-data php occ fulltextsearch:check
sudo -u www-data php occ fulltextsearch:test
-indexの作成
sudo -u www-data php occ fulltextsearch:index
-エラー数をリセットしたい場合
sudo -u www-data php occ fulltextsearch:index "{\"errors...
** daemon化 [#i6dcb3c9]
*** scriptの作成 [#ud6b6f62]
+sudo vi /usr/local/bin/nextCloudFullTextSearch.sh
#!/bin/sh
# Quick start-stop-daemon example, derived from Debian /...
set -e
# Must be a valid filename
NAME=fulltextsearch-daemon
PIDFILE=/var/run/$NAME.pid
#This is the command to be run, give the full pathname
DAEMON="/usr/bin/php"
DAEMON_OPTS="/var/www/nextcloud/occ fulltextsearch:live"
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
case "$1" in
start)
echo -n "Starting daemon: "$NAME
start-stop-daemon --start --background --quiet -...
echo "."
;;
stop)
echo -n "Stopping daemon: "$NAME
start-stop-daemon --stop --quiet --oknodo --pidf...
echo "."
;;
restart)
echo -n "Restarting daemon: "$NAME
start-stop-daemon --stop --quiet --oknodo --retr...
start-stop-daemon --start --background --quiet -...
echo "."
;;
*)
echo "Usage: "$1" {start|stop|restart}"
exit 1
esac
exit 0
+実行権限の追加
sudo chmod +x /usr/local/bin/nextCloudFullTextSearch.sh
*** systemctlへ登録 [#kb68eec9]
- [[参考サイト1(systemdの.serviceファイルで、実行ユーザー...
- [[参考サイト2(systemd のユニットファイルの作り方):https...
+ sudo vi /etc/systemd/system/nextCloudFullTextSearch.ser...
[Unit]
Description = nextCloudFullTextSearch
[Service]
Restart = no
Type = forking
User=www-data
Group=www-data
ExecStart = /usr/local/bin/nextCloudFullTextSearch.sh st...
ExecReload = /usr/local/bin/nextCloudFullTextSearch.sh r...
ExecStop = /usr/local/bin/nextCloudFullTextSearch.sh stop
[Install]
WantedBy = multi-user.target
+ 登録できたか確認
sudo systemctl list-unit-files --type=service | grep next
+ maskの解除
sudo systemctl unmask nextCloudFullTextSearch.service
-- 何故か上記のファイルが消えたので再度作成
*** 起動と自動起動化 [#o3c8d902]
sudo systemctl enable nextCloudFullTextSearch.service
sudo systemctl restart nextCloudFullTextSearch.service
*** 実行されているか確認 [#o1b541ba]
- ps ax | grep occ
** エラー対応 [#rb73b766]
*** Testing search platform. fail [#q498f982]
-エラー内容
$ sudo docker exec --user www-data nextcloud php occ ful...
.Testing your current setup:
Creating mocked content provider. ok
Testing mocked provider: get indexable documents. (2 ite...
Loading search platform. (Elasticsearch) ok
Testing search platform. fail
.Testing your current setup:
Creating mocked content provider. ok
Testing mocked provider: get indexable documents. (2 ite...
Loading search platform. (Elasticsearch) ok
Testing search platform. fail
-原因
--多分、ssl関連
-対策
--elasticsearchの非ssl化(https -> http)
*** retrieving content from a big index (license). fail [...
-原因
--「インデックス,インデックスの名前」が間違えている
-- &imgr(./image/nextCloud/nextCloudApp07.png,100%);
-対策
-- インデックス名を正しい文字列へ
-- NextCloud -> &br; -> 右上(イニシャル・アイコン)から「...
* その他 [#a7b320c1]
** sessionディレクトリへ権限追加 [#z716795d]
-参考サイト[[【Nextcloud】ログインループ (3) -アッサリ解...
*** sessionディレクトリの確認 [#k4f34570]
-phpinfo()で確認する
<?php
phpinfo();
?>
*** sessionディレクトリへアクセス兼を設定 [#u0bacdbf]
sudo chown apache: -R /var/lib/php/session
** パスワード・リセット [#l342e888]
sudo -u www-data php /var/www/nextcloud/occ user:resetpa...
** WebDav [#xf4dde6b]
*** WindowsのExplorer(エクスプローラー)でマウント [#g4393...
-なんとなくできなくなった?あるいはできなくなる?
--[[Microsoft、WebDAVを含む3つの機能をWindowsから非推奨へ...
-[[参考サイト:https://qiita.com/legitwhiz/items/9ec7d6728...
*** サードパーティのWebDavクライアントソフトを使います。 ...
-[[WebDavクライアントのまとめサイト:https://www.nminoru.j...
-- 個人的には「RaiDrive」が良いかな、と思いました。
--- [[RaiDrive download site:https://www.raidrive.com/dow...
** Apache実行ユーザーの変更 [#u3efce90]
***ログインできない [#w8acd740]
-大体、sessionフォルダへのアクセス権の問題
sudo chown apacheUser:ApacheUsers /var/lib/php/sessions -R
*** redis エラー [#m1c11177]
-redis グループへApache2実行ユーザーを追加
sudo gpasswd -a apacheUser redis
-daemon再起動
systemctl restart redis
systemctl restart apache2
***cron実行ユーザーの変更 [#u5ae7346]
- sudo vim /etc/cron.d/nextcloud
** 詳細ログ(ログイン、ログオフなど)の記録 [#pc5e887a]
+NextCloudへ「Auditing / Logging」アプリのインストール
+ログレベルを1(info)へ変更
-- sudo vi /var/www/nextcloud/config/config.php
'log_type' => 'file',
'logfile' => '/var/www/nextcloud-data/nextcloud.log',
'loglevel' => 1,
+以下のディレクトリ内、2つのファイルに記録される
/var/www/nextcloud-data/nextcloud.log
/var/www/nextcloud-data/audit.log
** upgrade後のレストア(restore)、バックアップから戻す [#b...
*** 参考サイト(公式) [#m7e339db]
-[[Restoring backup:https://docs.nextcloud.com/server/la...
*** restoreコマンド例 [#z9a3e831]
+最初にメンテンスモードをオン
sudo vi /var/www/nextcloud/config/config.php
'maintenance' => true,
+rsyncコマンドでバックップディレクトリからコピーする。
sudo rsync -Aaxv /var/www/nextcloud-data/updater-563ec6d...
+メンテナンス・モードをオフ
sudo vi /var/www/nextcloud/config/config.php
'maintenance' => false
+apache2のリスタート
systemctl restart apache2
** NextCloudクライアント(Windows)、仮想ファイルのローカル...
+以下のファイルを編集
%appdata%\nextcloud\nextcloud.cfg
+以下の場所を変更~
(フォルダのデリミッタはスラッシュなので注意。~
バックスラッシュ(\)ではない)
0\FoldersWithPlaceholders\1\localPath
--例
0\FoldersWithPlaceholders\1\localPath=D:/nextCloud
* エラー対処 [#g0b254b3]
** 参考サイト [#a7bad03f]
-[[Linuxで様々なサービスを構築しよう!!!:https://www.bi...
** cron.phpが実行されない [#g5e94c4d]
-以下に変更(/dev/null 2>&1を消し、apc.enable を追加)
-sudo vim /etc/cron.d/nextcloud
/usr/bin/php -f /var/www/nextcloud/cron.php --define apc...
-設定変更後は少し時間がかかる事がありますが、何回か実行し...
-実行されているかの確認は、NextCloudの「管理者設定」->「...
** updateに失敗する(create backup failed) [#c9e0f87d]
+最初に「対応バージョンがないアプリ」を確認。対応してない...
+以下のコマンドで確認
sudo -u www-data php --define apc.enable_cli=1 /var/www/...
+バックアップの失敗はpermissionエラーの場合が多い。~
以下のコマンドを実行
sudo chown www-data:www-data -R /var/www/nextcloud/*
** メンタンス・モード(Maintenanceモード)が解除されない。 ...
+以下のファイルを編集
sudo vim /var/www/nextcloud/config/config.php
+以下の場所
'maintenance' => false,
** Downgrading is not supported and is likely to cause un...
+apacheの再起動
sudo systemctl restart apache2
** 同期エラーで修正しようとしても「ローカルファイルコピー...
+NextCloud側にゴミが残っているので、ブラウザでNextCloudに...
(F5キーなど最新の情報に更新するのを忘れずに。。。)
** Windows用, NextCloud ファイル・クライアントで VCOMP140...
+以下をインストール
--[[Visual C++ Redistributable for Visual Studio 2015:htt...
ページ名: