ロリポップ!にクラウドストレージNextCloudをインストール

ロリポップ!にクラウドストレージを構築。Nextcloudとはサーバーにファイルを保管したり共有出来るオープンソースのソフトウェア。Webブラウザ、WindowsとMacのデスクトップアプリ、iOSとAndloidのスマートフォンアプリから操作可能

  1. ロリポップ!のサーバーでNextCloudを運用する注意事項
  2. ロリポップ!のサーバーでNextCloudをインストールする準備
    1. NextCloudを公開するサブドメインを作成
    2. SSLの設定
    3. データベースの作成
    4. WAFと海外アタックガードを無効にする
    5. ロリポップ!のユーザー専用ページでSSHを有効にする
      1. SSHで操作できるディレクトリ
      2. 使用可能コマンド一覧
    6. ロリポップ!のサーバーにSSHで接続する方法 Windows11の場合
      1. 自分のサーバーの番号を調べておく
    7. ロリポップ!のサーバーにSSHで接続して「pip」を使えるようにする
    8. Windows11 ターミナル(管理者)PowerShellを最新版に更新
  3. ロリポップ!のサーバーにNextCloudをインストール
    1. NexrCloudの公式サイトからインストールファイルをダウンロード
  4. 推奨アプリ
    1. Calendar
    2. Contacts
    3. Mail
    4. Nextcloud Office
    5. Notes
    6. Talk
  5. ロリポップ!にインストールしたNextCloudのエラーを解決
    1. リバースプロキシヘッダの設定が正しくありません。
    2. PHPのメモリ制限が推奨値の512 MB以下です。
    3. サーバーにはメンテナンスウィンドウの開始時間が設定されていません。
    4. One or more mimetype migrations are available.
    5. インスタンスの一部のヘッダーが正しく設定されていません
    6. PHP OPcacheモジュールが正しく設定されていません。
    7. データベースがトランザクションファイルロックに使われています。
    8. メモリキャッシュが設定されていません。
    9. ご使用のシステムには、デフォルトの電話地域が設定されていません。
    10. メールサーバーの設定が未設定または未確認です。
    11. このインスタンスには、いくつかの推奨 PHP モジュールがありません。
    12. いくつかの欠落しているオプションのインデックスを検出しました。
  6. 写真の共有
    1. サムネイルが表示されない
    2. 「+new」をクリックして写真を追加出来ない
  7. インストールしたプラグインの一覧
    1. Impersonate
      1. NextCloud Impersonate プラグインの使い方
    2. Antivirus for files
    3. Markdown editor
    4. Preview Generator
  8. 運用開始後のエラー
    1. ブルートフォース対策制限が適用されて…

ロリポップ!のサーバーでNextCloudを運用する注意事項

ロリポップ!では契約者以外にサーバー領域を貸し出すことを禁止しているので、クラウドストレージを貸すことは出来ません。ファイル共有など、節度を持って利用するのは可能なようです。意図せず個人用に貸し出さないために、プラグインで管理者が閲覧可能にしてその旨明示します。

ロリポップ!のサーバーでNextCloudをインストールする準備

NextCloudを公開するサブドメインを作成

ロリポップ!ユーザー専用ページ > サーバーの管理設定 > サブドメイン設定

ドメインをNextCloud専用にするなら、サブドメインの作成は不要。

ドメインをNextCloud専用にせず、サブドメインを使わない場合は、ロリポップ!ユーザー専用ページ > サーバーの管理設定 > ロリポップFTP ⇒ 「新規フォルダ作成」でディレクトリを作成するが、セキュリティの設定がドメインやサブドメイン単位なのでサブドメインが良い。

公開 (アップロード) フォルダを入力すると、ディレクトリは自動生成されるためFTPでの作成は不要。フォルダはサブドメイン名ではなく任意の文字列でも良い。

SSLの設定

ロリポップ!ユーザー専用ページ > セキュリティ > 独自SSL証明書導入

ロリポップ!では、ひとつの独自ドメインに対してサブドメインも含め無料で100件のSSLを設定可能。

データベースの作成

ロリポップ!ユーザー専用ページ:サーバーの管理・設定 > データベース

WAFと海外アタックガードを無効にする

ロリポップ!ユーザー専用ページ:セキュリティ > WAF設定

インストール後も有効にすると「写真フォルダを読み込めませんでした」というエラーが出る。アルバムの作成が出来ない、ファイルの表示が出来ないなどの不具合が生じた。

ロリポップ!ユーザー専用ページ:セキュリティ > 海外アタックガード

インストール後は有効

ロリポップ!ユーザー専用ページ:セキュリティ > アクセス制限

一般公開はしないので、ディレクトリにアクセス制限をかけて保護することにした。

ロリポップ!のユーザー専用ページでSSHを有効にする

NextCloudをインストールしたらエラーがたくさん出るので、SSH接続で修正しなければならない

ロリポップ!ユーザー専用ページ:サーバーの管理・設定 > SSH

「SSHを有効にする」をクリックすると、サーバー、アカウント、接続ポート、パスワードが表示される。以下のディレクトリとコマンドはロリポップ!のヘルプより転載

SSHで操作できるディレクトリ

  • /var/www (PHP プロジェクト, WordPressプロジェクトの場合)
  • /var/app (上記以外のプロジェクト種別の場合)
  • /var/log/container (ログディレクトリ)
  • /tmp (一時ディレクトリ)

使用可能コマンド一覧

SSH 上で sudo や su などのコマンドを利用した管理者権限は利用出来ない。
以下ロリポップ!のサポートページより転載

/bin/◯◯◯ のコマンド
/bin/awk/bin/basename/bin/bash
/bin/cat/bin/chmod/bin/cp
/bin/cut/bin/date/bin/echo
/bin/egrep/bin/env/bin/false
/bin/fgrep/bin/gawk/bin/grep
/bin/gunzip/bin/gzip/bin/hostname
/bin/link/bin/ln/bin/ls
/bin/mail/bin/mkdir/bin/more
/bin/mv/bin/nicebin/pwd
/bin/rm/bin/rmdir/bin/sed
/bin/sh/bin/sleep/bin/sort
/bin/stty/bin/tar/bin/touch
/bin/true/bin/unlink/bin/vi
/bin/zsh 
/usr/bin/◯◯◯ のコマンド
/usr/bin/clear/usr/bin/comm/usr/bin/convert
/usr/bin/csplit/usr/bin/diff/usr/bin/dir
/usr/bin/dircolors/usr/bin/dirname/usr/bin/du
/usr/bin/expand/usr/bin/expr/usr/bin/find
/usr/bin/fmt/usr/bin/fold/usr/bin/git
/usr/bin/groups/usr/bin/head/usr/bin/id
/usr/bin/install/usr/bin/join/usr/bin/less
/usr/bin/md5sum/usr/bin/mysql/usr/bin/nkf
/usr/bin/nl/usr/bin/od/usr/bin/paste
/usr/bin/perldoc/usr/bin/pr/usr/bin/printenv
/usr/bin/printf/usr/bin/ptx/usr/bin/readlink
/usr/bin/scp/usr/bin/seq/usr/bin/sha1sum
/usr/bin/split/usr/bin/sqlite3/usr/bin/stat
/usr/bin/sum/usr/bin/svn/usr/bin/tac
/usr/bin/tail/usr/bin/tee/usr/bin/test
/usr/bin/tr/usr/bin/tsort/usr/bin/tty
/usr/bin/unexpand/usr/bin/uniq/usr/bin/unzip
/usr/bin/vdir/usr/bin/vim/usr/bin/wc
/usr/bin/wget/usr/bin/which/usr/bin/whoami
/usr/bin/xargs/usr/bin/yes/usr/bin/zip
/usr/sbin/sendmail 
PHP・Perl・Ruby・Python のコマンド
/usr/local/php/PHPのバージョン/bin/php
(例:/usr/local/php/7.1/bin/php)
/usr/local/python/Pythonのバージョン/bin/python
(例:/usr/local/python/3.4/bin/python)
/usr/local/ruby/Rubyのバージョン/bin/ruby
(例:/usr/local/ruby/2.0/bin/ruby)
/usr/local/perl/Perlのバージョン/bin/perl
(例:/usr/local/perl/5.10/bin/perl)

ロリポップ!のサーバーにSSHで接続する方法 Windows11の場合

PowerShell(コマンドプロンプト)を開き, ssh SSHアカウント名@ホスト名 -p 2222と入力する。 初めて接続する際はメッセージが表示されるので,yesと入力してEnterを押す。 パスワードを入力して(文字列は表示されません),Enterを押す。

自分のサーバーの番号を調べておく

$ pwd
/home/users/番号/ユーザー名

ロリポップ!のサーバーにSSHで接続して「pip」を使えるようにする

Pythonのライブラリパッケージ管理ツール。cdでログインした場所に戻る

$ cd
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 2222k  100 2222k    0     0  8937k      0 --:--:-- --:--:-- --:--:-- 8961k
$ python3 get-pip.py --user
ERROR: This script does not work on Python 3.7. The minimum supported Python version is 3.8. Please use https://bootstrap.pypa.io/pip/3.7/get-pip.py instead.

バージョンが違うらしい…

$ curl https://bootstrap.pypa.io/pip/3.7/get-pip.py -o get-pip.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 2574k  100 2574k    0     0  14.1M      0 --:--:-- --:--:-- --:--:-- 14.2M
$ python3 get-pip.py --user
Collecting pip<24.1
  Using cached pip-24.0-py3-none-any.whl.metadata (3.6 kB)
Using cached pip-24.0-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 24.0
    Uninstalling pip-24.0:
      Successfully uninstalled pip-24.0
  WARNING: The scripts pip, pip3 and pip3.7 are installed in '/home/users/2/chu.jp-lasakura/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-24.0

パスがないらしい

$ vi .bash_profile
E325: 注意
次の名前でスワップファイルを見つけました ".bash_profile.swp"
            所有者: chu.jp-lasakura   日付: Mon Nov 11 12:48:27 2024
        ファイル名: ~chu.jp-lasakura/.bash_profile
          変更状態: あり
          ユーザ名: chu.jp-lasakura   ホスト名: spd175.phy.lolipop.jp
        プロセスID: 16717
次のファイルを開いている最中 ".bash_profile"

(1) 別のプログラムが同じファイルを編集しているかもしれません.
    この場合には, 変更をした際に最終的に, 同じファイルの異なる
    2つのインスタンスができてしまうことに注意してください.  終了するか, 注意しながら続けてください.
(2) このファイルの編集セッションがクラッシュした.
    この場合には ":recover" か "vim -r .bash_profile"
    を使用して変更をリカバーします(":help recovery" を参照).
    既にこれを行なったのならば, スワップファイル ".bash_profile.swp"
    を消せばこのメッセージを回避できます.

スワップファイル ".bash_profile.swp" が既にあります!
読込専用で開く([O]), とにかく編集する((E)), 復活させる((R)), 削除する((D)), 終了する((Q)), 中止する((A)):

Eを入力して編集する。上で調べた番号を使う

$ PATH=$PATH:/home/users/番号/ユーザー名/.local/bin
$ export PATH

入力が終わったら「escape」キーでコマンドモードに切り替えて、 コマンド「:wq」でファイルを保存して終了し、bash_profileをコマンドで更新

$ source .bash_profile

パスが通ったか確認する

$ pip3 list
Package                Version
---------------------- -------
colorama               0.4.6
Columnar               1.4.1
gmp                    0.0.17
mysql-connector-python 8.0.33
mysqlclient            2.1.1
pip                    24.0
protobuf               3.20.3
PyMySQL                1.0.3
setuptools             47.1.0
string-color           1.2.3
toolz                  0.12.1
wcwidth                0.2.13
wheel                  0.42.0

成功しました!

Windows11 ターミナル(管理者)PowerShellを最新版に更新

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

新機能と改善のために最新の PowerShell をインストールしてください!https://aka.ms/PSWindows

PS C:\Users\Windows11ユーザー名> winget search Microsoft.PowerShell
'msstore' ソースでは、使用する前に次の契約を表示する必要があります。
Terms of Transaction: https://aka.ms/microsoft-store-terms-of-transaction
ソースが正常に機能するには、現在のマシンの 2 文字の地理的リージョンをバックエンド サービスに送信する必要があります (例: "US")。

すべてのソース契約条件に同意しますか?
[Y] はい  [N] いいえ: y
名前               ID                           バージョン ソース
------------------------------------------------------------------
PowerShell         Microsoft.PowerShell         7.4.6.0    winget
PowerShell Preview Microsoft.PowerShell.Preview 7.5.0.5    winget
PS C:\Users\Windows11ユーザー名>

PS C:\Users\Windows11ユーザー名> winget install --id Microsoft.PowerShell --source winget
winget install --id Microsoft.PowerShell.Preview --source winget
見つかりました PowerShell [Microsoft.PowerShell] バージョン 7.4.6.0
このアプリケーションは所有者からライセンス供与されます。
Microsoft はサードパーティのパッケージに対して責任を負わず、ライセンスも付与しません。
ダウンロード中 https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/PowerShell-7.4.6-win-x64.msi
  ██████████████████████████████   104 MB /  104 MB
インストーラーハッシュが正常に検証されました
パッケージのインストールを開始しています...
   -
インストールが完了しました
PS C:\Users\Windows11ユーザー名> winget install --id Microsoft.PowerShell.Preview --source winget

再起動しても更新されてない?

スタートメニュー」ボタンを右クリックして、「ターミナル」(管理者)を起動する。タイトルバーの何もない処を右クリックして、「設定」を開く。「PowerShell」が7であることが確認できたので、スタートアップが「Windows PowerShell」になっているのを「PowerShell」に変更。

PowerShell 7.4.6
PS C:\Users\Windows11ユーザー名>

無事最新版になり、警告が消えました。

ロリポップ!のサーバーにNextCloudをインストール

NexrCloudの公式サイトからインストールファイルをダウンロード

NexrCloudの公式サイト > Community projects > Right-click here and save the file to your computer

hereをクリックしてダウンロード

ロリポップ!ユーザー専用ページ:サーバーの管理・設定 > ロリポップ!FTP

ダウンロードした「setup-nextcloud.php」をFTPでNextCloud用のディレクトリにアップロード

Setup Wizard

Welcome to the Setup Wizard for
Nextcloud!

This wizard will:
1. Check the server dependencies
2. Download Nextcloud
3. Install Nextcloud in a few simple steps

Next

「Next」をクリック

Dependency check

All Nextcloud dependencies found

Enter a single “.” to install in the current directory, or enter a subdirectory to install to:

入力欄

Next

入力欄はそのままインストールすると「nextcloud」フォルダが作成される。ドメインやサブドメインのトップページ、作成済みのディレクトリーを指定する場合、ピリオド「.」を入力します。今回はあらかじめインストールする領域を作成済みなのでピリオドを入力

Success

Nextcloud is now installed

Next

管理者アカウントを作成してください

ログイン

パスワード

ストレージとデータベース

パフォーマンス警告

あなたはSQLiteをデータベースとして選択しました。

SQLiteは小規模もしくは開発用のインスタンスでのみ利用できます。プロダクション環境では他のデータベースをお勧めします。

ファイルの同期にクライアントを使用している場合、SQLiteの使用はお勧めできません。

ストレージとデータベースをクリックすると、パフォーマンス警告以下の表示が変わる

データフォルダー データベースを設定してください

データフォルダー:デフォルトのまま

SQLite MySQL/MariraDB PostgreSQL(MySQLを選択)

データベースアカウント:あらかじめ作ったデータベースの情報入力 

データベースのパスワード:あらかじめ作ったデータベースの情報入力

データベース名:あらかじめ作ったデータベースの情報入力

データベースのホスト名:あらかじめ作ったデータベースのホスト名

ポート番号は不要。

データフォルダをメモする。ここを見なかったため、SSH接続で何日もやり直して、ロリポップ!はwww/htmlを使用しないことが分かった。

推奨アプリ

ここでWAFと海外アタックガードを無効にしないと、404エラーになりアクセス不能になる

Calendar

すべての端末と同期して、仕事と会議をスケジュールに組み込みます

Contacts

個人情報を漏らさずに、同僚や友人をまとめて保管します。

Mail

ファイル、連絡先、カレンダーとうまく合わさったシンプルなメールアプリ。

Nextcloud Office

Collabora Online上に構築された、共同作業ドキュメント、スプレッドシート、およびプレゼンテーション

Notes

集中モードメモアプリ

Talk

チャット、ビデオ通話、画面共有、オンラインミーティング、ウェブ会議 – ブラウザーとモバイルアプリで。

スキップ 推奨アプリをインストール

ロリポップ!にインストールしたNextCloudのエラーを解決

リバースプロキシヘッダの設定が正しくありません。

リバースプロキシヘッダの設定が正しくありません。これはセキュリティ上の問題で、攻撃者が自分のIPアドレスをNextcloudに見えるように偽装することができます。

ロリポップ!ユーザー専用ページ:サーバーの管理・設定 > ロリポップ!FTP
NextCloudをインストールしたディレクトリ/config/config.php に追記

  'trusted_proxies' =>
    array (
        0 => 'サーバーのIPアドレス',
    ),

PHPのメモリ制限が推奨値の512 MB以下です。

ロリポップ!のphp.ini 設定では、「LiteSpeed版、モジュール版のPHPではphp.iniの設定変更はできません。」とあるので、 .htaccessに追記

ロリポップ!ユーザー専用ページ:サーバーの管理・設定 > ロリポップ!FTP
NextCloudをインストールしたディレクトリ/.htaccess に追記

php_value memory_limit 512M
php_value memory_limit 4096M
php_value post_max_size 2048M
php_value upload_max_filesize 1024M
php_value max_execution_time 600

1回のアップロード、アップロード最大サイズ、実行時間の最長単位は秒

サーバーにはメンテナンスウィンドウの開始時間が設定されていません。

これは、リソースを多く使用する日常のバックグラウンドジョブが、メインの利用時間中にも実行されることを意味します。利用者がこれらの重いタスクによる負荷の影響を受けにくくするために、低い利用時間に設定することをおすすめします。

ロリポップ!ユーザー専用ページ:サーバーの管理・設定 > ロリポップ!FTP
NextCloudをインストールしたディレクトリ/config/config.php に追記
ついでに地域と言語も

  'default_timezone' => 'Asia/Tokyo',
  'maintenance_window_start' => 1,
  'default_language' => 'ja',
  'default_locale' => 'ja',

One or more mimetype migrations are available.

One or more mimetype migrations are available. Occasionally new mimetypes are added to better handle certain file types. Migrating the mimetypes take a long time on larger instances so this is not done automatically during upgrades. Use the command occ maintenance:repair --include-expensive to perform the migrations.

 サーバーにSSHでログインしてコマンドを入力

$ cd web/インストールしたディレクトリ
$ php8.3 occ maintenance:repair --include-expensive
The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see https://www.php.net/manual/en/book.pcntl.php
Additionally the function 'pcntl_signal' and 'pcntl_signal_dispatch' need to be enabled in your php.ini.
The current PHP memory limit is below the recommended value of 512MB.
 - Repair MySQL collation
     - All tables already have the correct collation -> nothing to do
 - Clean tags and favorites
     - 0 tags of deleted users have been removed.
     - 0 tags for delete files have been removed.
     - 0 tag entries for deleted tags have been removed.
     - 0 tags with no entries have been removed.
 - Repair invalid shares
 - Move .step file of updater to backup location
 - Add move avatar background job
     - Add background job
 - Add preview cleanup background jobs
 - Migrate oauth2_clients table to nextcloud schema
     - Update the oauth2_access_tokens table schema.
     - Update the oauth2_clients table schema.
     - Delete clients (and their related access tokens) with the redirect_uri starting with oc:// or ending with *
 - Repair language codes
 - Add log rotate job
 - Clear frontend caches
     - Image cache cleared
     - JS cache cleared
 - Clear every generated avatar
 - Add preview background cleanup job
 - Queue a one-time job to cleanup old backups of the updater
 - Cleanup invalid photocache files for carddav
 - Add background job to cleanup login flow v2 tokens
 - Remove potentially over exposing share links
     - No need to remove link shares.
 - Clear access cache of projects
 - Reset generated avatar flag
 - Keep legacy encryption enabled
 - Check encryption key format
 - Remove old dashboard app config data
 - Add job to cleanup the bruteforce entries
 - Queue a one-time job to check for user uploaded certificates
 - Repair DAV shares
 - Add background job to set the lookup server share state for users
 - Add token cleanup job
 - Clean up abandoned apps
 - Add possibly missing system config
 - Add AI tasks cleanup jobs
 - Queue a job to generate metadata
 - migrate lazy config values
 - Cache logo dimension to fix size in emails on Outlook
     - Theming is not used to provide a logo
 - Remove legacy ".ocdata" file
 - Add cleanup-deleted-users background job
 - Remove shares of old group memberships
 - Repair mime types
 - Validate the phone number and store it in a known format for search
     - WARNING: Can not validate phone numbers without `default_phone_region` being set in the config file
 - Handle outdated scheduling events
     - Cleaning up old scheduling events
     - Adding background job to delete old scheduling objects
 - AppAPI Daemons configuration GPU params update
     - Daemons configuration GPU params updated: 0
 - Upgrading Circles App
 - Fix component of birthday calendars
     - 0 birthday calendars updated.
 - Regenerating birthday calendars to use new icons and fix old birthday events without year
     - Adding background jobs to regenerate birthday calendar
 - Fix broken values of calendar objects
    0 [->--------------------------]
 - Registering building of calendar search index as background job
     - Add background job
 - Register building of social profile search index as background job
 - Registering background jobs to update cache for webcal calendars
     - Added 0 background jobs to update webcal calendars
 - Registering building of calendar reminder index as background job
     - Add background job
 - Clean up orphan event and contact data
     - 0 events without a calendar have been cleaned up
     - 0 properties without an events have been cleaned up
     - 0 changes without a calendar have been cleaned up
     - 0 cached events without a calendar subscription have been cleaned up
     - 0 changes without a calendar subscription have been cleaned up
     - 0 contacts without an addressbook have been cleaned up
     - 0 properties without a contact have been cleaned up
     - 0 changes without an addressbook have been cleaned up
 - Remove activity entries of private events
     - Removed 0 activity entries
 - Clean up old calendar subscriptions from deleted users that were not cleaned-up
    0 [----->----------------------]
     - 0 calendar subscriptions without an user have been cleaned up
 - Remove invalid object properties
     - 0 invalid object properties removed.
 - Fix the share type of guest shares when migrating from ownCloud
 - Copy the share password into the dedicated column
 - Set existing shares as accepted
 - Restore default tags that are missing
     - Looking up default tags
     - 0 accounts to check found
    0 [--------->------------------]
 - Add a generated message-id to all Mail messages that have none
     - Looking up messages without a message-id
 - Purify and migrate collected mail addresses
    0 [------------->--------------]
 - Insert background jobs for all accounts
    0 [---------------->-----------]
 - Make Mail itinerary extractor executable
     - itinerary file doesn't exist
 - Create or update provisioned Mail accounts
     - 0 accounts provisioned
 - Repair Broken Threads for all mail accounts
     - Repaired threads, 0 messages updated
 - Queue a job to delete duplicated cached messages
 - Clean up meta table
 - Show a hint about the new editor to existing users
 - Update OAuth token expiration times
 - init metadata
 - Invalidate access cache for projects conversation provider
 - Cache the user display names
 - Switches from default updater server to the customer one if a valid subscription is available
 - Send an admin notification if monthly report is disabled
 - Force-reset all Text document sessions
 - Initialize migration of background images from dashboard to theming app
 - Add background job to check for backup codes
 - Populating added database structures for workflows

エラーは解消されました

インスタンスの一部のヘッダーが正しく設定されていません

– `Strict-Transport-Security` HTTPヘッダーが設定されていません(少なくとも `15552000` 秒に設定する必要があります)。セキュリティを強化するために、HSTSを有効にすることを推奨します。

ロリポップ!ユーザー専用ページ:サーバーの管理・設定 > ロリポップ!FTP
NextCloudをインストールしたディレクトリ/.htaccess に追記

<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
<IfModule mod_setenvif.c>

PHP OPcacheモジュールが正しく設定されていません。

OPcache のインターン化文字列バッファがほぼいっぱいです。繰り返しの文字列を効果的にキャッシュするために、PHPの設定に “opcache.interned_strings_buffer” を “8” よりも高い値で設定することをおすすめします。

データベースがトランザクションファイルロックに使われています。

データベースがトランザクションファイルロックに使われています。パフォーマンスをあげるには、可能であればメモリーのキャッシュを設定してください。

メモリキャッシュが設定されていません。

メモリキャッシュが設定されていません。パフォーマンスを向上させるため、利用可能であればメモリキャッシュを設定してください。

ご使用のシステムには、デフォルトの電話地域が設定されていません。

ロリポップ!ユーザー専用ページ:サーバーの管理・設定 > ロリポップ!FTP
NextCloudをインストールしたディレクトリ/config/config.php
$CONFIG = arrayの()の中に追記

  'default_phone_region' => 'JP',

メールサーバーの設定が未設定または未確認です。

メールサーバーの設定が未設定または未確認です。「基本設定」で設定を行ってください。その後、フォームの下にある「メールを送信」ボタンで設定を確認してください。

迷惑メールが来ることを想定して専用のドメインメールを作成して設定して解決した

このインスタンスには、いくつかの推奨 PHP モジュールがありません。

このインスタンスには、いくつかの推奨 PHP モジュールがありません。パフォーマンスと互換性を向上させるために、これらをインストールすることを強くお勧めします: – gmp WebAuthn パスワードレスログインと、SFTPストレージ用 – sysvsem

$ cd web/nextcloud
$ python3 -m pip install gmp
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: gmp in ./.local/lib/python3.7/site-packages (0.0.17)
Requirement already satisfied: string-color in ./.local/lib/python3.7/site-packages (from gmp) (1.2.3)
Requirement already satisfied: setuptools in /usr/local/python/3.7/lib/python3.7/site-packages (from string-color->gmp) (47.1.0)
Requirement already satisfied: columnar>=1.3.1 in ./.local/lib/python3.7/site-packages (from string-color->gmp) (1.4.1)
Requirement already satisfied: colorama in ./.local/lib/python3.7/site-packages (from string-color->gmp) (0.4.6)
Requirement already satisfied: toolz in ./.local/lib/python3.7/site-packages (from columnar>=1.3.1->string-color->gmp) (0.12.1)
Requirement already satisfied: wcwidth in ./.local/lib/python3.7/site-packages (from columnar>=1.3.1->string-color->gmp) (0.2.13)

まだ消えない。ドキュメントから関連しそうなモジュールを入れてみる

$ python3 -m pip install bcmath
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement bcmath (from versions: none)
ERROR: No matching distribution found for bcmath
$ python3 -m pip install 

いくつかの欠落しているオプションのインデックスを検出しました。

いくつかの欠落しているオプションのインデックスを検出しました。データベースのパフォーマンスを向上させるために、(Nextcloudまたはインストールされたアプリケーションによって)新しいインデックスが追加されることがあります。インデックスの追加には時間がかかり、一時的にパフォーマンスが低下することがあるため、アップグレード時には自動的には行われません。インデックスが追加されると、それらのテーブルへのクエリが速くなるはずです。インデックスを追加するには、`occ db:add-missing-indices` コマンドを使用してください。インデックスが不足: “mail_messages_strucanalyz_idx” テーブル内の “mail_messages”, “mail_class_creat_idx” テーブル内の “mail_classifiers”, “mail_acc_prov_idx” テーブル内の “mail_accounts”, “mail_alias_accid_idx” テーブル内の “mail_aliases”, “systag_by_objectid” テーブル内の “systemtag_object_mapping”, “mail_messages_mb_id_uid_uidx” テーブル内の “mail_messages”, “mail_smime_certs_uid_email_idx” テーブル内の “mail_smime_certificates”, “mail_trusted_senders_idx” テーブル内の “mail_trusted_senders”, “mail_coll_idx” テーブル内の “mail_coll_addresses”.

PowerShell 7.4.6
PS C:\Users\Windows11のユーザー名> ssh SSHアカウント名@ホスト名 -p 2222
SSHアカウント名@ホスト名's password:
[SSHアカウント名@spd175 ~]$

ターミナルからSSHでサーバーにログインし、webディレクトリに移動します。PHPのバージョンを調べてエラー画面で指示されたコマンドを入力する

$ cd web/Nextcloudをインストールしているディレクトリ
$ php8.3 --define apc.enable_cli=1 occ db:add-missing-indices
The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see https://www.php.net/manual/en/book.pcntl.php
Additionally the function 'pcntl_signal' and 'pcntl_signal_dispatch' need to be enabled in your php.ini.
The current PHP memory limit is below the recommended value of 512MB.
Adding additional mail_messages_strucanalyz_idx index to the oc_mail_messages table, this can take some time...
oc_mail_messages table updated successfully.
Adding additional mail_class_creat_idx index to the oc_mail_classifiers table, this can take some time...
oc_mail_classifiers table updated successfully.
Adding additional mail_acc_prov_idx index to the oc_mail_accounts table, this can take some time...
oc_mail_accounts table updated successfully.
Adding additional mail_alias_accid_idx index to the oc_mail_aliases table, this can take some time...
oc_mail_aliases table updated successfully.
Adding additional systag_by_objectid index to the oc_systemtag_object_mapping table, this can take some time...
oc_systemtag_object_mapping table updated successfully.
Adding additional mail_messages_mb_id_uid_uidx index to the oc_mail_messages table, this can take some time...
Removing mail_messages_mb_id_uid index from the oc_mail_messages table
oc_mail_messages table updated successfully.
Adding additional mail_smime_certs_uid_email_idx index to the oc_mail_smime_certificates table, this can take some time...
Removing mail_smime_certs_uid_idx index from the oc_mail_smime_certificates table
oc_mail_smime_certificates table updated successfully.
Adding additional mail_trusted_senders_idx index to the oc_mail_trusted_senders table, this can take some time...
Removing mail_trusted_senders_type index from the oc_mail_trusted_senders table
oc_mail_trusted_senders table updated successfully.
Adding additional mail_coll_idx index to the oc_mail_coll_addresses table, this can take some time...
Removing mail_coll_addr_userid_index index from the oc_mail_coll_addresses table
Removing mail_coll_addr_email_index index from the oc_mail_coll_addresses table
oc_mail_coll_addresses table updated successfully.

写真の共有

写真 > アルバム 「+新しいアルバム」をクリックして作成する

「+new」をクリックして写真を追加。「アルバム名に追加」で選択して追加の二段階操作

サムネイルが表示されない

Antivirus for filesプラグインを一度インストールすると、無効にしても回復しなかった

「+new」をクリックして写真を追加出来ない

アカウント作成時にファイルの欠落か破損があったようでアルバムの写真の追加ができない。普通のアカウントは削除して作り直せば良いが、管理者は作り直しが出来ないので、何度もやり直したり、データベースやサブドメインを作り直したりしたが管理者ではうまくいかなかった

インストールしたプラグインの一覧

公式プラグインで役に立ちそうなものをインストールして有効にしました

Impersonate

管理者権限でログイン アプリ > ツール >  Impersonate

管理者が他ユーザのファイルを閲覧可能にするプラグイン。「ダウンロードして有効にする」をクリック。意図せず個人用にクラウドストレージを貸し出さないために、管理者が閲覧してチェックし、違反したら削除したりアクセス不能にするなどの条件を明示します。

NextCloud Impersonate プラグインの使い方

管理者権限でログイン アカウント > 閲覧したいアカウントの三点リーダー >  代理

「閲覧したいアカウントの代理ユーザーになってもよろしいですか?」と聞かれるので「はい」をクリックすると当該ユーザーと同じように使える。「ログアウト」すると、アカウント画面に戻る。一度もログインしていないユーザーは代理ユーザーになれない。

Antivirus for files

管理者権限でログイン アプリ > セキュリティ >  Antivirus for files

「ダウンロードして有効にする」をクリック⇒写真のサムネイルが表示されなくなるので無効

Markdown editor

管理者権限でログイン アプリ > Office & テキスト >  Markdown editor

WordPressのコメントで使用しているので同じにする。「テストされていないアプリを許可する」をクリック。「ダウンロードして有効にする」をクリック

Preview Generator

管理者権限でログイン アプリ > マルチメディア >  Preview Generator

「ダウンロードして有効にする」をクリック

運用開始後のエラー

ブルートフォース対策制限が適用されて…

要求が多すぎます

ネットワークからのリクエストが多すぎました。このようなエラーが発生した場合は、後で再試行するか、管理者に連絡してください。

数時間開けて再度ログインしようとすると、以下の通り警告メッセージが

あなたのIPから複数の無効なログイン試行が検出されました。 したがって、次回のログインは最大30秒間抑制されます。

管理 > 概要 のエラーメッセージで解決方法を確認

あなたの接続アドレスが”{ipaddress}”として識別され、現在ブルートフォース対策制限が適用されているため、さまざまなリクエストのパフォーマンスが低下しています。接続アドレスがあなたのアドレスでない場合、プロキシが正しく設定されていない可能性があります。

ターミナルからSSHでサーバーにログインし、webディレクトリに移動します。

$ cd web/nextcloud

PHPのバージョンを調べてエラー画面で指示されたコマンドを入力する

php8.3 --define apc.enable_cli=1 occ security:bruteforce:reset {ipaddress}

ロリポップ!の管理画面:サーバーの管理・設定 > ロリポップ!FTP
NextCloudをインストールしたディレクトリ/config/config.php に追記

 'auth.bruteforce.protection.enabled' => true,

ターミナルにipconfigと入力してIPアドレスとサブネットマスクを調べる

セキュリティ > ブルートフォースIPホワイトリスト

サブネット マスク . . . . . . . . . .: 255.255.255.0

255.255.255.0を2進数に換算すると、先頭から1が24個並びます。 “/24”

新しいホワイトリストを追加する

リモートアドレス/24

コメント

タイトルとURLをコピーしました