Nginxを別のユーザーとして実行すると、WordPressを更新すると「アップデートをインストールできません...」というエラーが返されます。

Nginxを別のユーザーとして実行すると、WordPressを更新すると「アップデートをインストールできません...」というエラーが返されます。

これはNginxをカスタマイズする最初の試みであり、すでにDigital Ocean Dropletで実行されています。私のサイトファイルはにあります/sites/rob_app

  • すべてが属するrob
  • すべてのファイルは0644
  • すべてのディレクトリは0755

robNginxが実行されているユーザーを変更しましたnginx.conf。サイトが実行されますが、WordPressまたはプラグインを更新しようとすると、次のエラーが発生します。

Unpacking the update…

The update cannot be installed because some files could not be copied. This is usually due to inconsistent file permissions.: wp-admin/includes/update-core.php

Installation failed.

Nginxエラーログを見ると、ファイル権限の問題のように聞こえますが、Nginxを実行しており、robファイル所有者は次のようになりますrob

2023/01/27 01:08:51 [error] 11253#11253: *6 FastCGI sent in stderr: "PHP message: PHP Warning:  copy(/sites/rob_app/subdomains/vril/public/wp-admin/includes/update-core.php): Failed to open stream: Permission denied in /sites/rob_app/subdomains/vril/public/wp-admin/includes/class-wp-filesystem-direct.php on line 309" while reading upstream, client: (redacted)), server: vril.robr.app, request: "POST /wp-admin/update-core.php?action=do-core-reinstall HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "(redacted)", referrer: "(redacted)/wp-admin/update-core.php"

すべてのサイトファイルのファイル所有者をに変更しwww-dataてNginxが実行されているユーザーを変更すると、www-dataWordPressとプラグインを正常に更新できますrob/sites/使用しない場合sudo

理由がわかりません。www-dataファイル所有者www-dataのようなNginxのキャンセル、しかしrobファイル所有者としてrobNginxを実行します。(スイッチ間でファイル権限が変更されていない場合も同様です)。

私のものnginx.conf

user rob;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 1024;
}

http {
    sendfile on;
    tcp_nopush on;
    types_hash_max_size 2048;
    server_tokens off; 

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

    # https://sysopstechnix.com/7-tips-for-nginx-performance-tuning/
    client_body_buffer_size 10K;
    client_header_buffer_size 1k;
    client_max_body_size 8m;
    large_client_header_buffers 4 4k;   
    ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;

    add_header Last-Modified "";    
}

ベストアンサー1

Nginxのユーザー:グループと一致すると、FastCGIのユーザー:グループを変更する必要があり、すべてが機能しました。

おすすめ記事