PR 広告

Nextcloud セキュリティ&セットアップ警告を修正する方法

00b-Nextcloud セキュリティ&セットアップ警告を修正する方法_最初の一歩 Surlofia サアロフィア Nextcloud
【PR】当サイトはアフィリエイト広告を利用しています。

【2022年12月】エックスサーバーで、Nextcloud Hub 3 (バージョン 25.0.2) に更新する方法を解説します。「500番エラー、メンテナンス中」の解決方法と「セキュリティ&セットアップ警告」の修正方法も解説します。
[注釈] エックスサーバーの 500番エラーで Nextcloud (サーバー側) をアップデートできないトラブルの解決策と、警告の修正方法を解説します。出典リンク付きです。

[December 2022] This section explains how to update to Nextcloud Hub 3 (version 25.0.2) on X server. It also explains how to resolve “Error 500, under maintenance” and how to fix “Security & Setup Warning”.
[Note] This page explains how to solve the problem of not being able to update Nextcloud (server side) due to error 500 on X server and how to fix the warning. Source link included.

この記事が、Nextcloud 関係の目次というかスタートの記事です。

This article is the table of contents, or rather the start, of the Nextcloud relationship.

Contents 目次
  1. Nextcloud インストール&アップデート
  2. セキュリティ&セットアップ警告
    Security & setup warnings
  3. セキュリティスキャン
    Nextcloud Security Scan
  4. ロリポップレンタルサーバーにインストールする方法

Nextcloud インストール&アップデート

クラウド保存でファイル共有したいひと向けの記事です

2台以上のパソコンやスマホでデータ共有したいひとにお薦めの記事です。

WordPress 用レンタルサーバーの空き容量を有効活用したいひとに最適な記事です。

ファイルサーバーを作りたいけれど、パソコンは増やしたくないひとにもお薦めです。

レンタルサーバーの情報について

  • エックスサーバー スタンダードプラン
  • PHP 8.1.12
  • データベース MariaDB10.5 

下記のリンクからエックスサーバーを申し込めば、紹介特典が適用されます。
(利用期限: 2023年04月30日まで)
https://surlofia.com/xsvr

1つのドメインに 1つだけ

1つのドメインに2つの Nextcloud をインストールしてはいけません。(経験談)
ドメインのフォルダルートの .htaccess を変更する必要があるなどが理由です。

2024年9月20日 インストールファイルのダウンロード

DOWNLOAD FOR DESKTOP ユーザー側のソフトウェア

DOWNLOAD FOR DESKTOP の Windows 10 64 bit からダウンロードします。

2024年9月20日 追記
Nextcloud デスクトップクライアント バージョン 3.13.4 (Windows). を使用中です。ダウンロードリンク Nextcloud-3.13.4-x64.msi
最新バージョンの 3.14.0 を使用すると、同期に失敗します。

Server stopped accepting new streams before this stream was established?
というエラーが何度も出てファイルの同期が失敗しましたが、バージョン 3.13.4 のクライアントソフトを使用することで正常になりました。

thalunil
With a fresh sync, i have the same issue with the version 3.14.0 on Windows.
Version 3.13.4 works as expected.

https://github.com/nextcloud/desktop/issues/7136#issuecomment-2354806574

DOWNLOAD SERVER レンタルサーバー側のソフトウェア

COMMUNITY PROJECTS の Web installer からダウンロードします。

Nextcloud Hub 3 (25.0.2) を使用中です。(2022-12(Dec)-12 月 Monday)
Nextcloud Hub 3 (25.0.1) を使用中です。(2022-12(Dec)-07 金 Friday)

500 Internal Server Error

Nextcloud のログイン画面が表示されない場合

403 Forbidden

インストールフォルダのパーミッション変更
705 を 755 へ

メンテナンス中のまま

Contiune with web based updater
Maintenance mode will get disabled.
Parsing response failed.

または

Contiune with web based updater
Disable maintenance mode and continue in the web based updater.

https:// (あなたのドメイン名) / (nextcloud をインストールしたフォルダ) /config/config.php

‘maintenance’ => true, を
‘maintenance’ => false, に修正する。
※ true を false に変える。

または、
‘maintenance’ => true, の下に、
‘maintenance’ => false, を追加する。

Check for expected files

extra files (余分なファイル) となった setup-nextcloud.php をフォルダから削除する。

セキュリティ&セットアップ警告
Security & setup warnings

Nextcloud エラーは2つ残ります。
Two Nextcloud errors remain.

エックスサーバー(スタンダードプラン)の限界です。
This is the limit of the X server (Standard plan).

エックスサーバー
X server
http://surlofia.com/xsvr

Nextcloud エラーは2つ残ります。エックスサーバー(スタンダードプラン)の限界です。

Some files have not passed the integrity check. Further information on how to resolve this issue can be found in the documentation ↗. (List of invalid files… / Rescan…)

This instance is missing some recommended PHP modules. For improved performance and better compatibility it is highly recommended to install them.
sodium

バックグラウンドジョブの設定を確認してください。
Check the background job settings .

一部のファイルは整合性チェックに合格していません。
Some files have not passed the integrity check.

リバースプロキシヘッダーの構成が正しくないか、信頼できるプロキシからNextcloudにアクセスしています。
The reverse proxy header configuration is incorrect, or you are accessing Nextcloud from a trusted proxy.

Strict-Transport-Security “HTTP ヘッダーの秒数が少なくとも”15552000” に設定されていません。
The “Strict-Transport-Security” HTTP header is not set to at least “15552000” seconds.

Webサーバーで “/.well-known/xxxxxx” が解決されるように正しく設定されていません。
Your web server is not properly set up to resolve “/.well-known/xxxxxx”.

PHP OPcacheモジュールが正しく設定されていません。
The PHP OPcache module is not properly configured

Nextcloud PHP OPcacheモジュールが正しく設定されていません。
https:// (あなたのドメイン名) / (nextcloud をインストールしたフォルダ) /index.php/settings/admin/overview
https:// (your domain name) / (the folder where you installed nextcloud) /index.php/settings/admin/overview

The maximum number of OPcache keys is nearly exceeded. To assure that all scripts can be hold in cache, it is recommended to apply opcache.max_accelerated_files to your PHP configuration with a value higher than 130987.
The OPcache buffer is nearly full. To assure that all scripts can be hold in cache, it is recommended to apply opcache.memory_consumption to your PHP configuration with a value higher than 3072.
The OPcache interned strings buffer is nearly full. To assure that repeating strings can be effectively cached, it is recommended to apply opcache.interned_strings_buffer to your PHP configuration with a value higher than 96.

https:// (あなたのドメイン名) / (nextcloud をインストールしたフォルダ) /index.php/settings/admin/overview
https:// (your domain name) / (the folder where you installed nextcloud) /index.php/settings/admin/overview

エックスサーバー
サーバーパネル
PHP
PHPバージョン切替
で、
PHP 8.1.12
に変更します。

データベースにいくつかのインデックスがありません。
Some indexes are missing in the database.

メールサーバーの設定が未設定または未確認です。
You have not set or verified your email server configuration, yet.

ご使用のシステムには、デフォルトの電話地域が設定されていません。
Your installation has no default phone region set.

メモリーキャッシュが構成されていません。
No memory cache has been configured.

このインスタンスには推奨されるPHPモジュールがいくつかありません。
This instance is missing some recommended PHP modules.

サーバーにはメンテナンスウィンドウの開始時間が設定されていません。
Server has no maintenance window start time configured.

 使用中に、4時間かかるメンテナンスモードが始まらないように、開始時刻を指定する。

 日本時間の深夜1時である、UTC 16 時を指定します。
‘maintenance’ => false,
の次の行に、

'maintenance_window_start' => 16,

を追加します。

UTCの1時は、日本時間(JST)では10時です。
日本時間の深夜1時(JST)は、UTCでは16時(前日の午後4時)です。

日本時間はUTCに対して+9時間の時差があります。

maintenance_window_start

Note

This setting is only taken into account in cron mode.

In the config/config.php file you can specify this config. Some background jobs only run once a day. When an hour is defined (timezone is UTC) for this config, the background jobs which advertise themselves as not time-sensitive will be delayed during the “working” hours and only run in the 4 hours after the given time. This is e.g. used for activity expiration, suspicious login training, and update checks.

A value of 1 e.g. will only run these background jobs between 01:00am UTC and 05:00am UTC:

'maintenance_window_start' => 1,
Nextcloud configuration Background jobs
Parameters
https://docs.nextcloud.com/server/29/admin_manual/configuration_server/background_jobs_configuration.html

1 つ以上の MIME タイプの移行が利用可能です。
One or more mimetype migrations are available.

NextCloud の構成ファイルを更新するコマンド

サブフォルダにインストールしている場合
/usr/bin/php8.1 --define apc.enable_cli=1 /home/ユーザーID/exsample.com/public_html/インストールしたサブフォルダ名/occ maintenance:repair --include-expensive
専用のサブドメインにインストールしている場合
/usr/bin/php8.1 --define apc.enable_cli=1 /home/ユーザーID/exsample.com/public_html/専用のサブドメイン.exsample.com/occ maintenance:repair --include-expensive

または

/usr/bin/php8.1 --define apc.enable_cli=1 /home/ユーザーID/exsample.com/public_html/専用のサブドメイン/occ maintenance:repair --include-expensive

サブドメインを保存するフォルダを設定する方法は、2つあります。
あなたが、どちらの方法を選んだか確認してください。

SSH コマンドを実行するための準備は、下記をご覧ください。

セキュリティスキャン
Nextcloud Security Scan

Nextcloud Security Rating A+

サブドメインのルートにインストールすれば、A+ にできました。
ただし、ドキュメントルートのフォルダのパーミッション変更が必要です。
711 –> 755

If installed in the root of a subdomain, an A+ could be achieved.
However, you need to change the permissions on the folder in the document root.
711 -> 755

Nextcloud Security Rating A + plus

www. と サブドメインを両立したいひとへ
For those who want to combine www. and subdomains

# 301リダイレクトの記述
# Description of 301 redirects

RewriteEngine on

# index.html無しのURLに統一
# Unify URLs without index.html

RewriteCond %{THE_REQUEST} ^.*/index.html
RewriteRule ^(.*)index.html$ $1 [L,R=301]

# http "s" のURLに統一
# Unify URLs with http "s"

RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# ルートをwwwのURLに統一
# Unify root with www URL

# https://www.adam.ne.jp/support/tips/url-normalization/
#  [NC] は大文字と小文字を区別しないことを表すフラグです。
#  [OR] は複数の条件を OR でつなぐフラグです。いずれかの条件に一致した場合を表します。
#  [OR] がなければ AND でつないだことになり、すべての条件に一致した場合を表します。
# [NC] is a case-insensitive (= uppercase and lowercase letters) flag.
# [OR] is a flag that ORs multiple conditions together. If any of the conditions are met, it means that one of the conditions is met.
# [OR] indicates that all conditions are ANDed together.

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} !^nextcloud9999\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteEngine off

# 301リダイレクトの記述 おわり
# Description of 301 redirects End

本ドメインからのアクセスを無効にする方法
How to disable access from the domain

サブドメインのアクセスのみを許可して、ドメインでのアクセスを禁止する方法
How to allow only subdomain access and prohibit access by domain

http://abc.example.jp/ の場合、通常 http://example.jp/abc.example.jp/(http://example.jp/abc/)でもアクセスが可能となります。

.htaccess に下記の「記述内容」を記載し、サブドメインフォルダ内(abc.example.comまたはabcフォルダ)に設置することにより、http://example.jp/abc.example.jp/(http://example.jp/abc/)でのアクセスを拒否することも可能です。

.htaccessファイルの設置先
/example.jp/public_html/abc.example.com/(/example.jp/public_html/abc/)
記述内容(下記は abc.example.jp でのアクセスのみ許可する、という内容です。)

SetEnvIf Host "^abc.example.jp$" host
order deny,allow
deny from all
allow from env=host
https://www.xserver.ne.jp/manual/man_domain_subdomain_setting.php

お得に、エックスサーバーを申し込みたいひとへ

お友達紹介プログラム (利用期限:2023/04/30)を利用できるリンクです。

Nextcloud Security Rating A

Nextcloudのセキュリティは、セキュリティスキャン ↗でチェックしてください。
https://scan.nextcloud.com/

サブフォルダにインストールしても、A+ にする方法は分かりません。

Nextcloud Security Rating A

ロリポップレンタルサーバーにインストールする方法

「ストレージとデータベース」を左クリックすると行けるとのこと。

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