Nextcloud version (18.0.1):
Operating system and version (Ubuntu 18.04):
Apache or nginx version (nginx 1.17.10):
PHP version (7.4 is shown as active using “systemctl status php*”):
The issue you are facing:
Hi,
I’ve recently tried manually updating to php7.4 on my system because another web service I wanted to configure required it. Ever since then, nextcloud has been warning me about a misconfigured php service on the admin-overview panel. Today I wanted to fix php on my system but unfortunately,
systemctl restart php*
and
systemctl restart nginx
have resulted in my page no longer being accessible from the internet. I am now always greeted with a “502 bad gateway nginx” message. I know it has something to do with a wonky php configuration, but no idea how to fix it.
Is this the first time you’ve seen this error? (Y):
Steps to replicate it:
- Try to access Nextcloud
The output of your Nextcloud log in Admin > Logging:
2020/06/04 16:56:31 [crit] 30525#30525: *82569 connect() to unix:/run/php/php7.3-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 185.210.219.156, server: blablabla.space, request: "GET /csrftoken HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.3-fpm.sock:", host: "blablabla.space"
2020/06/04 16:56:51 [crit] 30525#30525: *82569 connect() to unix:/run/php/php7.3-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 185.210.219.156, server: blablabla.space, request: "POST /apps/rainloop/app/?/Ajax/&q[]=/_kJ-VtTBcwlM8-wLZZfTdarOhGHdxM3FJzGN8Mc7uXYIk_E-5IgmdCPmqsvZ0ORxXZQGO_yf2GVemxNBHA5rE0J3zkq6wbFde_aysddbPsRK5ybpZ9vPLhyXlcLbCoMaqUp7vvdIF59YM-ACZADEY6n4XjGmn63vp1KDZ$HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.3-fpm.sock:", host: "blablabla.space"
2020/06/04 16:56:58 [crit] 30525#30525: *85139 connect() to unix:/run/php/php7.3-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 185.210.219.156, server: blablabla.space, request: "PROPFIND /remote.php/dav/files/me/ HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.3-fpm.sock:", host: "blablabla.space"
2020/06/04 16:57:28 [crit] 30525#30525: *85139 connect() to unix:/run/php/php7.3-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 185.210.219.156, server: blablabla.space, request: "PROPFIND /remote.php/dav/files/me/ HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.3-fpm.sock:", host: "blablabla.space"
The output of your config.php file in /path/to/nextcloud
(make sure you remove any identifiable information!):
<?php
$CONFIG = array (
'passwordsalt' => 'blablabla',
'secret' => 'blablabla',
'trusted_domains' =>
array (
0 => 'localhost',
1 => 'blablabla.space',
),
'datadirectory' => '/var/nc-data',
'dbtype' => 'mysql',
'version' => '18.0.1.3',
'overwrite.cli.url' => 'https://blablabla.space',
'dbname' => 'nextcloud',
'dbhost' => 'localhost',
'dbport' => '',
'dbtableprefix' => 'oc_',
'mysql.utf8mb4' => true,
'dbuser' => 'nextcloud',
'dbpassword' => '',
'installed' => true,
'instanceid' => '',
'memcache.local' => '\\OC\\Memcache\\APCu',
'redis' =>
array (
'host' => '/var/run/redis/redis.sock',
'port' => '0',
'timeout' => '0.0',
),
'memcache.locking' => '\\OC\\Memcache\\Redis',
'filelocking.enabled' => 'true',
'enable_previews' => 'true',
'enabledPreviewProviders' =>
array (
0 => 'OC\\Preview\\PNG',
1 => 'OC\\Preview\\JPEG',
2 => 'OC\\Preview\\GIF',
3 => 'OC\\Preview\\BMP',
4 => 'OC\\Preview\\XBitmap',
5 => 'OC\\Preview\\Movie',
6 => 'OC\\Preview\\PDF',
7 => 'OC\\Preview\\MP3',
8 => 'OC\\Preview\\TXT',
9 => 'OC\\Preview\\MarkDown',
),
'preview_max_x' => '1024',
'preview_max_y' => '768',
'preview_max_scale_factor' => '1',
'auth.bruteforce.protection.enabled' => 'true',
'trashbin_retention_obligation' => 'auto,7',
'skeletondirectory' => '',
'defaultapp' => 'file',
'activity_expire_days' => '14',
'integrity.check.disabled' => 'false',
'updater.release.channel' => 'stable',
'mail_smtpmode' => 'smtp',
'mail_smtpsecure' => 'ssl',
'mail_sendmailmode' => 'smtp',
'mail_from_address' => 'webmaster',
'mail_domain' => 'blablabla.space',
'mail_smtpauthtype' => 'LOGIN',
'mail_smtpauth' => 1,
'mail_smtphost' => 'smtp.blablabla.de',
'mail_smtpport' => '465',
'mail_smtpname' => 'webmaster@blablabla.space',
'mail_smtppassword' => 'blablabla',
'maintenance' => false,
'theme' => '',
'loglevel' => 2,
);
The output of your Apache/nginx/system log in /var/log/____
:
I accessed the nginx error log. It really only has one (repeated ad infinitum), which after a quick googling seems to be unrelated (and has also appeared in the logs for a whole while now, so not connected to php is my guess):
2020/06/04 17:32:37 [error] 32418#32418: send() failed (111: Connection refused) while resolving, resolver: 127.0.0.1:53
I also present my
nginx.conf:
user www-data;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
multi_accept on;
use epoll;
}
http {
server_names_hash_bucket_size 128;
upstream php-handler {
server unix:/run/php/php7.4-fpm.sock;
}
upstream onlyoffice-docker {
server 127.0.0.1:8443;
}
set_real_ip_from 127.0.0.1;
set_real_ip_from 10.0.0.0/8;
set_real_ip_from 172.16.0.0/12;
set_real_ip_from 192.168.2.0/24;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
include /etc/nginx/mime.types;
#include /etc/nginx/ssl.conf;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'"$host" sn="$server_name" '
'rt=$request_time '
'ua="$upstream_addr" us="$upstream_status" '
'ut="$upstream_response_time" ul="$upstream_response_length" '
'cs=$upstream_cache_status' ;
access_log /var/log/nginx/access.log main;
sendfile on;
send_timeout 3600; tcp_nopush on; tcp_nodelay on; open_file_cache max=500 inactive=10m;
open_file_cache_errors on; keepalive_timeout 65; reset_timedout_connection on;
server_tokens off;
resolver 127.0.0.1;
resolver_timeout 10s; include /etc/nginx/conf.d/*.conf;
My nextcloud server block:
server {
listen 80 default_server;
server_name blablabla.space;
#Your DDNS adress, (e.g. from desec.io or no-ip.com)
location ^~ /.well-known/acme-challenge {
proxy_pass http://127.0.0.1:81;
}
location / {
return 301 https://$server_name:443;
}
}
server {
listen 443 ssl http2;
server_name blablabla.space;
root /var/www/nextcloud/;
access_log /var/log/nginx/nextcloud.access.log main;
error_log /var/log/nginx/nextcloud.error.log warn;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location = /.well-known/carddav {
return 301 $scheme://$host:443/remote.php/dav;
}
location = /.well-known/caldav {
return 301 $scheme://$host:443/remote.php/dav;
}
location = /.well-known/webfinger {
return 301 $scheme://$host:443/public.php?service=webfinger;
}
location ^~ /loleaflet {
proxy_pass https://localhost:9980;
proxy_set_header Host $http_host;
}
location ^~ /hosting/discovery {
proxy_pass https://localhost:9980;
proxy_set_header Host $http_host;
}
location ^~ /lool {
proxy_pass https://localhost:9980;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade";
}
client_max_body_size 10240M;
location / {
rewrite ^ /index.php;
}
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
deny all;
}
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
deny all;
}
location ~* \.(?:flv|mp4|mov|m4a)$ {
mp4;
mp4_buffer_size 5m;
mp4_max_buffer_size 10m;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
include /etc/nginx/conf.d/php_optimization.conf;
fastcgi_pass php-handler;
fastcgi_param HTTPS on;
}
location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provi$ fastcgi_split_path_info ^(.+\.php)(/.*)$; try_files $fastcgi_script_name =404;
include fastcgi_params;
include /etc/nginx/conf.d/php_optimization.conf;
fastcgi_pass php-handler;
fastcgi_param HTTPS on;
}
location ~ ^/(?:updater|ocs-provider)(?:$|/) {
try_files $uri/ =404;
index index.php;
}
location ~ \.(?:css|js|woff|svg|gif)$ {
try_files $uri /index.php$uri$is_args$args;
add_header Cache-Control "public, max-age=15778463";
access_log off;
expires 30d;
}
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
try_files $uri /index.php$uri$is_args$args;
access_log off;
expires 30d;
}