방금 Nextcloud 인스턴스를 19.0.5로 업데이트한 다음 20.0.2(내장 업데이트 프로그램)로 업데이트했습니다.
첫 번째 업데이트 후 웹 인터페이스와 클라이언트 모두 연결 문제(504 게이트웨이 시간 초과)가 발생했고 연결이 완료되었을 때 응답 속도가 느려졌습니다. 설정 페이지로 돌아가서 19.05에서 20.02로 업데이트했지만 연결 문제가 지속됩니다.
유지 관리 모드에서는 페이지가 정상적으로 로드됩니다.
내 IP 주소를 입력하면 nginx 페이지가 매우 빠르게 로드됩니다.
내 nextcloud 도메인 입력https://www.ssllabs.com/ssltest/보안 등급이 A+라는 것을 보여줍니다. 새로운 연결을 만들어야 하도록 캐시를 지웠어요.
문제를 진단하기 위해 몇 가지 조치를 취했지만 아무것도 나오지 않습니다.
nginx를 다시 시작했습니다.
sudo systemctl reload nginx
sudo nginx -t
것을 보여줍니다
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
나는 /var/log/php7.4.log를 확인했고 이것의 많은 줄을 발견했습니다.
05-Dec-2020 12:06:50] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
나는 /etc/php/fpm/pool.d/www.conf로 가서 max_children을 40으로 늘렸습니다.
그리고 PHP는 잘 돌아가는 것 같습니다:
● php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2020-12-06 09:16:53 EST; 4h 15min ago
Docs: man:php-fpm7.4(8)
Process: 1086 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/7.4/fpm/pool.d/www.conf 74 (code=>
Main PID: 868 (php-fpm7.4)
Status: "Processes active: 40, idle: 0, Requests: 22306, slow: 0, Traffic: 0req/sec"
Tasks: 41 (limit: 28592)
Memory: 790.9M
CGroup: /system.slice/php7.4-fpm.service
├─ 868 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)
├─ 3195 php-fpm: pool www
├─ 3198 php-fpm: pool www
├─ 3202 php-fpm: pool www
├─ 3226 php-fpm: pool www
├─ 3239 php-fpm: pool www
├─ 3251 php-fpm: pool www
├─ 3258 php-fpm: pool www
├─ 3261 php-fpm: pool www
├─ 3268 php-fpm: pool www
├─ 3271 php-fpm: pool www
├─ 3281 php-fpm: pool www
├─ 3337 php-fpm: pool www
├─ 3340 php-fpm: pool www
├─ 3363 php-fpm: pool www
├─ 3369 php-fpm: pool www
├─ 3376 php-fpm: pool www
├─ 3389 php-fpm: pool www
├─ 3393 php-fpm: pool www
├─ 3399 php-fpm: pool www
├─ 3406 php-fpm: pool www
├─ 3409 php-fpm: pool www
├─ 3412 php-fpm: pool www
├─ 3415 php-fpm: pool www
├─ 3480 php-fpm: pool www
├─ 3631 php-fpm: pool www
├─14761 php-fpm: pool www
├─14763 php-fpm: pool www
├─14765 php-fpm: pool www
├─14767 php-fpm: pool www
├─14769 php-fpm: pool www
├─14822 php-fpm: pool www
├─14824 php-fpm: pool www
├─14826 php-fpm: pool www
├─14828 php-fpm: pool www
├─14830 php-fpm: pool www
├─14832 php-fpm: pool www
├─14957 php-fpm: pool www
├─14962 php-fpm: pool www
├─14964 php-fpm: pool www
└─47101 php-fpm: pool www
정보를 표시하기 위해 PHP를 설정했습니다.
sudo 나노 /usr/share/nginx/html/info.php
<?php phpinfo(); ?>
그러나 정보를 표시하는 대신 브라우저에서 localhost/info.php로 이동하면 파일을 열라는 메시지가 표시됩니다.
나는 NetHogs로 서버를 모니터링하고 있으며 원격 웹 브라우저에서 서버에 연결할 때 많은 수의 php-fpm: pool www 프로세스가 참여하고 있지만 ~1KB/초만 보내고 받는 것을 확인합니다.
/etc/nginx/conf.d/nextcloud.conf의 내용은 다음과 같습니다. (실제 서버를 'mynextcloud'로 교체했습니다.)
server {
server_name mynextcloud;
# Add headers to serve security related headers
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
add_header Referrer-Policy no-referrer;
#I found this header is needed on Ubuntu, but not on Arch Linux.
add_header X-Frame-Options "SAMEORIGIN";
# Path to the root of your installation
root /usr/share/nginx/nextcloud/;
access_log /var/log/nginx/nextcloud.access;
error_log /var/log/nginx/nextcloud.error;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# The following 2 rules are only needed for the user_webfinger app.
# Uncomment it if you're planning to use this app.
#rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
#rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json
# last;
location = /.well-known/carddav {
return 301 $scheme://$host/remote.php/dav;
}
location = /.well-known/caldav {
return 301 $scheme://$host/remote.php/dav;
}
location ~ /.well-known/acme-challenge {
allow all;
}
# set max upload size
client_max_body_size 16G;
fastcgi_buffers 64 4K;
# Disable gzip to avoid the removal of the ETag header
gzip off;
# Uncomment if your server is build with the ngx_pagespeed module
# This module is currently not supported.
#pagespeed off;
#error_page 403 /core/templates/403.php;
#error_page 404 /core/templates/404.php;
location / {
rewrite ^ /index.php$uri;
}
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
deny all;
}
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
deny all;
}
location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34])\.php(?:$|/>
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
#Avoid sending the security headers twice
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ ^/(?:updater|ocs-provider)(?:$|/) {
try_files $uri/ =404;
index index.php;
}
# Adding the cache control header for js and css files
# Make sure it is BELOW the PHP block
location ~* \.(?:css|js)$ {
try_files $uri /index.php$uri$is_args$args;
add_header Cache-Control "public, max-age=7200";
# Add headers to serve security related headers (It is intended to
# have those duplicated to the ones above)
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
add_header Referrer-Policy no-referrer;
# Optional: Don't log access to assets
access_log off;
}
location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ {
try_files $uri /index.php$uri$is_args$args;
# Optional: Don't log access to other assets
access_log off;
}
listen 443 ssl http2; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/www.dysoncloud.net/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/www.dysoncloud.net/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
add_header Strict-Transport-Security "max-age=31536000" always;
ssl_trusted_certificate /etc/letsencrypt/live/mynextcloud/chain.pem; # managed by Certbot
ssl_stapling on; # managed by Certbot
ssl_stapling_verify on; # managed by Certbot
}
server {
if ($host = mynextcloud) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name mynextcloud;
listen 80;
return 404; # managed by Certbot
}
/usr/share/nginx/nextcloud/config/config.php의 내용
<?php
$CONFIG = array (
'instanceid' => 'xxx',
'passwordsalt' => 'xxx',
'secret' => 'xxx',
'trusted_domains' =>
array (
0 => 'www.dysoncloud.net',
),
'datadirectory' => '/usr/share/nginx/nextcloud-data',
'dbtype' => 'mysql',
'version' => '19.0.5.2',
'overwrite.cli.url' => 'https://www.dysoncloud.net',
'dbname' => 'nextcloud',
'dbhost' => 'localhost:3306',
'dbport' => '',
'dbtableprefix' => 'oc_',
'mysql.utf8mb4' => true,
'dbuser' => 'nextclouduser',
'dbpassword' => 'xxx',
'installed' => true,
'memcache.local' => '\\OC\\Memcache\\APCu',
'mail_from_address' => 'dysonsphere',
'mail_smtpmode' => 'smtp',
'mail_sendmailmode' => 'smtp',
'mail_domain' => 'startmail.com',
'mail_smtpauthtype' => 'LOGIN',
'mail_smtpauth' => 1,
'mail_smtphost' => 'smtp.startmail.com',
'mail_smtpport' => '465',
'mail_smtpname' => '[email protected]',
'mail_smtppassword' => 'xxxxxxxxxxxxxxxxx',
'mail_smtpsecure' => 'ssl',
'maintenance' => false,
'updater.release.channel' => 'stable',
'updater.secret' => 'xxx',
'theme' => '',
'loglevel' => 2,
);
/var/log/nginx/error.log 내용:
020/12/06 09:16:52 [warn] 1056#1056: "ssl_stapling" ignored, host no
t found in OCSP responder "ocsp.int-x3.letsencrypt.org" in the certif
icate "/etc/letsencrypt/live/collabra.ddns.net/fullchain.pem"
2020/12/06 09:16:52 [warn] 1056#1056: "ssl_stapling" ignored, host no
t found in OCSP responder "ocsp.int-x3.letsencrypt.org" in the certif
icate "/etc/letsencrypt/live/www.dysoncloud.net/fullchain.pem"
2020/12/06 10:02:36 [error] 1064#1064: *7389 open() "/usr/share/nginx
/html/robots.txt" failed (2: No such file or directory), client: 66.2
49.66.215, server: collabra.ddns.net, request: "GET /robots.txt HTTP/
1.1", host: "dysoncloud.net"
2020/12/06 10:43:21 [error] 1064#1064: *13017 open() "/usr/share/ngin
x/html/TP/public/index.php" failed (2: No such file or directory), cl
ient: 134.175.245.162, server: collabra.ddns.net, request: "GET /TP/p
ublic/index.php HTTP/1.1", host: "24.202.235.154"
2020/12/06 10:43:23 [error] 1064#1064: *13018 open() "/usr/share/ngin
x/html/TP/index.php" failed (2: No such file or directory), client: 1
34.175.245.162, server: collabra.ddns.net, request: "GET /TP/index.ph
p HTTP/1.1", host: "24.202.235.154"
2020/12/06 10:43:25 [error] 1064#1064: *13019 open() "/usr/share/ngin
x/html/thinkphp/html/public/index.php" failed (2: No such file or dir
ectory), client: 134.175.245.162, server: collabra.ddns.net, request:
"GET /thinkphp/html/public/index.php HTTP/1.1", host: "24.202.235.15
4"
2020/12/06 10:43:26 [error] 1064#1064: *13020 open() "/usr/share/ngin
x/html/html/public/index.php" failed (2: No such file or directory),
client: 134.175.245.162, server: collabra.ddns.net, request: "GET /ht
ml/public/index.php HTTP/1.1", host: "24.202.235.154"
2020/12/06 10:43:29 [error] 1064#1064: *13021 open() "/usr/share/ngin
x/html/public/index.php" failed (2: No such file or directory), clien
t: 134.175.245.162, server: collabra.ddns.net, request: "GET /public/
index.php HTTP/1.1", host: "24.202.235.154"
2020/12/06 10:43:29 [error] 1064#1064: *13022 open() "/usr/share/ngin
x/html/TP/html/public/index.php" failed (2: No such file or directory
), client: 134.175.245.162, server: collabra.ddns.net, request: "GET
/TP/html/public/index.php HTTP/1.1", host: "24.202.235.154"
2020/12/06 10:43:31 [error] 1064#1064: *13023 open() "/usr/share/ngin
x/html/elrekt.php" failed (2: No such file or directory), client: 134
.175.245.162, server: collabra.ddns.net, request: "GET /elrekt.php HT
TP/1.1", host: "24.202.235.154"
2020/12/06 10:43:32 [error] 1064#1064: *13024 open() "/usr/share/ngin
x/html/index.php" failed (2: No such file or directory), client: 134.
175.245.162, server: collabra.ddns.net, request: "GET /index.php HTTP
/1.1", host: "24.202.235.154"
2020/12/06 11:15:46 [error] 1064#1064: *17649 open() "/usr/share/ngin
x/html/wp-login.php" failed (2: No such file or directory), client: 1
61.35.36.90, server: collabra.ddns.net, request: "GET /wp-login.php H
TTP/1.1", host: "aaa.aaa.dysoncloud.net"
020/12/06 12:01:14 [error] 1064#1064: *22713 open() "/usr/share/ng
inx/html/jars" failed (2: No such file or directory), client: 91.24
1.19.84, server: collabra.ddns.net, request: "GET /jars HTTP/1.1",
host: "24.202.235.154:80"
2020/12/06 12:03:27 [error] 1064#1064: *22915 open() "/usr/share/ng
inx/html/.env" failed (2: No such file or directory), client: 104.4
1.134.160, server: collabra.ddns.net, request: "GET /.env HTTP/1.1"
, host: "24.202.235.154"
2020/12/06 12:04:07 [error] 1064#1064: *22983 open() "/usr/share/ng
inx/html/.env" failed (2: No such file or directory), client: 104.4
1.134.160, server: collabra.ddns.net, request: "GET /.env HTTP/1.1"
, host: "24.202.235.154"
2020/12/06 12:11:01 [error] 1064#1064: *23750 open() "/usr/share/ng
inx/html/.env" failed (2: No such file or directory), client: 104.4
1.134.160, server: collabra.ddns.net, request: "GET /.env HTTP/1.1"
, host: "24.202.235.154"
2020/12/06 12:11:21 [error] 1064#1064: *23754 open() "/usr/share/ng
inx/html/.env" failed (2: No such file or directory), client: 104.4
1.134.160, server: collabra.ddns.net, request: "GET /.env HTTP/1.1"
, host: "24.202.235.154"
2020/12/06 12:18:50 [crit] 1064#1064: *24549 SSL_do_handshake() fai
led (SSL: error:14201044:SSL routines:tls_choose_sigalg:internal er
ror) while SSL handshaking, client: 64.41.200.107, server: 0.0.0.0:
443
2020/12/06 12:19:07 [error] 1064#1064: *24559 open() "/usr/share/ng
inx/html/favicon.ico" failed (2: No such file or directory), client
: 192.168.1.1, server: collabra.ddns.net, request: "GET /favicon.ic
o HTTP/1.1", host: "24.202.235.154", referrer: "http://24.202.235.1
54/"
020/12/06 12:48:50 [error] 1064#1064: *28039 "/usr/share/nginx/htm
l/phpmyadmin/index.html" is not found (2: No such file or directory
), client: 113.24.145.137, server: collabra.ddns.net, request: "GET
/phpmyadmin/ HTTP/1.1", host: "24.202.235.154"
2020/12/06 12:57:14 [error] 1064#1064: *28972 open() "/usr/share/ng
inx/html/nextcloud" failed (2: No such file or directory), client:
192.168.1.1, server: collabra.ddns.net, request: "GET /nextcloud HT
TP/1.1", host: "24.202.235.154"
2020/12/06 12:57:26 [error] 1064#1064: *28972 open() "/usr/share/ng
inx/html/dysoncloud" failed (2: No such file or directory), client:
192.168.1.1, server: collabra.ddns.net, request: "GET /dysoncloud
HTTP/1.1", host: "24.202.235.154"
2020/12/06 13:04:50 [crit] 1064#1064: *29760 SSL_do_handshake() fai
led (SSL: error:14201044:SSL routines:tls_choose_sigalg:internal er
ror) while SSL handshaking, client: 64.41.200.107, server: 0.0.0.0:
443
2020/12/06 13:35:05 [error] 1064#1064: *33403 open() "/usr/share/ng
inx/html/config/getuser" failed (2: No such file or directory), cli
ent: 2.57.122.186, server: collabra.ddns.net, request: "GET /config
/getuser?index=0 HTTP/1.1", host: "24.202.235.154:80"
2020/12/06 13:45:54 [error] 1064#1064: *34617 open() "/usr/share/ng
inx/html/Licenses/jQuery FileSearch (MIT).php" failed (2: No such f
ile or directory), client: 35.189.229.112, server: collabra.ddns.ne
t, request: "POST /Licenses/jQuery%20FileSearch%20(MIT).php HTTP/1.
1", host: "24.202.235.154", referrer: "https://www.google.com/"
/var/log/nginx/nextcloud.error의 최근 내용:
2020/12/06 11:17:35 [error] 1064#1064: *17387 upstream timed out (110: Connection timed out) while reading response header from upstream, cl
ient: 192.168.1.1, server: www.dysoncloud.net, request: "GET /apps/files/?fileNotFound=1 HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.
4-fpm.sock", host: "www.dysoncloud.net"
2020/12/06 12:18:34 [error] 1064#1064: *24364 upstream timed out (110: Connection timed out) while reading response header from upstream, cl
ient: 192.168.1.1, server: www.dysoncloud.net, request: "GET /apps/files/?fileNotFound=1 HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.
4-fpm.sock", host: "www.dysoncloud.net"
2020/12/06 12:22:33 [error] 1064#1064: *24364 upstream timed out (110: Connection timed out) while reading response header from upstream, cl
ient: 192.168.1.1, server: www.dysoncloud.net, request: "GET /apps/recommendations/api/recommendations HTTP/2.0", upstream: "fastcgi://unix:
/run/php/php7.4-fpm.sock", host: "www.dysoncloud.net"
2020/12/06 12:23:54 [error] 1064#1064: *25125 upstream timed out (110: Connection timed out) while reading response header from upstream, cl
ient: 192.168.1.1, server: www.dysoncloud.net, request: "GET /settings/apps HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock",
host: "www.dysoncloud.net"
2020/12/06 12:27:50 [error] 1064#1064: *25732 upstream timed out (110: Connection timed out) while reading response header from upstream, cl
ient: 192.168.1.1, server: www.dysoncloud.net, request: "GET /settings/apps HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock",
host: "www.dysoncloud.net"
2020/12/06 12:31:14 [error] 1064#1064: *25732 upstream timed out (110: Connection timed out) while reading response header from upstream, cl
ient: 192.168.1.1, server: www.dysoncloud.net, request: "GET /settings/apps HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock",
host: "www.dysoncloud.net"
2020/12/06 12:33:01 [error] 1064#1064: *26227 upstream timed out (110: Connection timed out) while reading response header from upstream, cl
ient: 192.168.1.1, server: www.dysoncloud.net, request: "GET /apps/dashboard/ HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock"
, host: "www.dysoncloud.net"
2020/12/06 12:36:49 [error] 1064#1064: *26725 upstream timed out (110: Connection timed out) while reading response header from upstream, cl
ient: 192.168.1.1, server: www.dysoncloud.net, request: "GET /apps/dashboard/ HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock"
, host: "www.dysoncloud.net"
2020/12/06 12:39:10 [error] 1064#1064: *26725 upstream timed out (110: Connection timed out) while reading response header from upstream, cl
ient: 192.168.1.1, server: www.dysoncloud.net, request: "GET /apps/dashboard/ HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock"
, host: "www.dysoncloud.net"
2020/12/06 12:42:13 [error] 1064#1064: *26725 upstream timed out (110: Connection timed out) while reading response header from upstream, cl
ient: 192.168.1.1, server: www.dysoncloud.net, request: "GET /apps/dashboard/ HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock"
, host: "www.dysoncloud.net"
2020/12/06 12:44:17 [error] 1064#1064: *27415 upstream timed out (110: Connection timed out) while reading response header from upstream, cl
ient: 192.168.1.1, server: www.dysoncloud.net, request: "GET /apps/files/?fileNotFound=1 HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.
4-fpm.sock", host: "www.dysoncloud.net"
2020/12/06 12:49:00 [error] 1064#1064: *27954 upstream timed out (110: Connection timed out) while reading response header from upstream, cl
ient: 192.168.1.1, server: www.dysoncloud.net, request: "GET /apps/files/?fileNotFound=1 HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.
4-fpm.sock", host: "www.dysoncloud.net"
2020/12/06 12:55:24 [error] 1064#1064: *28647 upstream timed out (110: Connection timed out) while reading response header from upstream, cl
ient: 192.168.1.1, server: www.dysoncloud.net, request: "GET /apps/files/?fileNotFound=1 HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.
4-fpm.sock", host: "www.dysoncloud.net"
나는 이 시점에서 무엇을 해야 할지 모르겠습니다. 내 nextcloud 인스턴스는 현재 거의 쓸모가 없으며 어제까지 너무 많이 활용하고 있었습니다. 전체를 다시 빌드하지 않고도 이 문제를 해결할 수 있는 방법이 있기를 바랍니다.
이에 대해 생각이 있으신 분에게 미리 감사드립니다.
답변1
/etc/nginx/nginx.conf에서 time_out을 600초로 설정했습니다.
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
fastcgi_send_timeout 600s;
fastcgi_read_timeout 600s;
sendfile on;
그런 다음 Nextcloud 웹 인터페이스의 앱 페이지로 이동하여(로드되는 데 5분 정도 기다린 후) 위의 오류 메시지에 표시된 Collabra를 비활성화할 수 있었습니다.
/var/log/nginx/error.log의 예:
2020/12/06 10:43:25 [error] 1064#1064: *13019 open() "/usr/share/ngin/html/thinkphp/html/public/index.php" failed (2: No such file or directory), client: 134.175.245.162, server: collabra.ddns.net, request:"GET /thinkphp/html/public/index.php HTTP/1.1", host: "24.202.235.154"
Collabra 앱을 비활성화한 후 Nextcloud 웹 인터페이스의 모든 페이지가 예상대로 로드되었고 Nextcloud 데스크톱과 Android 클라이언트가 지연 없이 동기화되었습니다.