Nextcloud version: 22.2.6-r0
Operating system and version: Alpine Linux 3.15 (kernel 5.15.32-0-lts x86_64)
nginx version: 1.20.2-r1
PHP version: 8.0.18-r0
The issue you are facing: Internal server error
Is this the first time you’ve seen this error? N
Steps to replicate it:
- Install nextcloud from official Alpine 3.15 repo
- Install postgresql, configure the db
- Install nginx
- Configure with the following settings.
- Start stack
- Point the browser to the nextcloud folder’s index
- Try starting php-fpm8 service but not nextcloud service, vice versa or both, nothing changes.
The output of your Nextcloud log in Admin > Logging: N/A
The output of your config.php file in /etc/nextcloud
(make sure you remove any identifiable information!):
<?php
$CONFIG = array (
'datadirectory' => '/var/lib/nextcloud/data',
'logfile' => '/var/log/nextcloud/nextcloud.log',
'apps_paths' =>
array (
0 =>
array (
'path' => '/var/www/nextcloud/apps',
'url' => '/apps',
'writable' => false,
),
1 =>
array (
'path' => '/var/lib/nextcloud/apps',
'url' => '/apps-appstore',
'writable' => true,
),
),
'updatechecker' => false,
'check_for_working_htaccess' => false,
'installed' => false,
'instanceid' => 'ocmgxv1rtkp9',
);
The output of your php-fpm log in /var/log/nextcloud
:
[03-May-2022 18:31:45] ERROR: Another FPM instance seems to already listen on /run/nextcloud/fastcgi.sock
[03-May-2022 18:31:45] ERROR: FPM initialization failed
I’m having a really hard time getting Nextcloud to work on my server with the aforementioned setup. /var/log/nextcloud/nextcloud.log keeps throwing these nonsensical messages:
{"reqId":"ycZ0VuGuXQ5iYOUJICtu","level":3,"time":"2022-05-03T18:19:14+00:00","remoteAddr":"10.0.0.3","user":"--","app":"base","method":"GET","url":"/nextcloud","message":"Failed to start session","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36","version":"","exception":{"Exception":"Exception","Message":"Failed to start session","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/base.php","line":423,"function":"__construct","class":"OC\\Session\\Internal","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":645,"function":"initSession","class":"OC","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1089,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextcloud/index.php","line":34,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Session/Internal.php","Line":62,"CustomMessage":"--"}}
{"reqId":"E7WHMf82xAv1Vocpij0q","level":3,"time":"2022-05-03T18:29:49+00:00","remoteAddr":"10.0.0.3","user":"--","app":"base","method":"GET","url":"/nextcloud","message":"Failed to start session","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36","version":"","exception":{"Exception":"Exception","Message":"Failed to start session","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/base.php","line":423,"function":"__construct","class":"OC\\Session\\Internal","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":645,"function":"initSession","class":"OC","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1089,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextcloud/index.php","line":34,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Session/Internal.php","Line":62,"CustomMessage":"--"}}
{"reqId":"n2dRylrAacfW8w9LkZZr","level":3,"time":"2022-05-03T18:31:07+00:00","remoteAddr":"10.0.0.3","user":"--","app":"base","method":"GET","url":"/nextcloud","message":"Failed to start session","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36","version":"","exception":{"Exception":"Exception","Message":"Failed to start session","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/base.php","line":423,"function":"__construct","class":"OC\\Session\\Internal","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":645,"function":"initSession","class":"OC","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1089,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextcloud/index.php","line":34,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Session/Internal.php","Line":62,"CustomMessage":"--"}}
{"reqId":"2JYP4UmRj3gzgu0OvN7X","level":3,"time":"2022-05-03T18:31:48+00:00","remoteAddr":"10.0.0.3","user":"--","app":"base","method":"GET","url":"/nextcloud","message":"Failed to start session","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36","version":"","exception":{"Exception":"Exception","Message":"Failed to start session","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/base.php","line":423,"function":"__construct","class":"OC\\Session\\Internal","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":645,"function":"initSession","class":"OC","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1089,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextcloud/index.php","line":34,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Session/Internal.php","Line":62,"CustomMessage":"--"}}
contents of /etc/nginx/http.d/foo.bar.conf:
upstream php-handler {
#server 127.0.0.1:9000;
server unix:/var/run/php-fpm8/php-fpm.sock;
}
# Set the `immutable` cache control options only for assets with a cache busting `v` argument
map $arg_v $asset_immutable {
"" "";
default "immutable";
}
server {
listen 80;
#listen [::]:80;
server_name foo.bar;
# Prevent nginx HTTP Server Detection
server_tokens off;
# Enforce HTTPS
return 301 https://$server_name$request_uri;
}
server {
#listen [::]:80; #uncomment for IPv6 support
# return 301 https://$server_name$request_uri;
server_name foo.bar;
listen [::]:443 ssl http2;
listen 443 ssl http2; # managed by Certbot
listen unix:/run/nginx/foo.bar.sock ssl http2 proxy_protocol;
ssl_certificate /etc/letsencrypt/live/foo.bar/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/foo.bar/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
server_tokens off;
root /var/www/nextcloud;
index index.php index.html /index.php$request_uri;
disable_symlinks off;
# set max upload size and increase upload timeout:
client_max_body_size 2G;
client_body_timeout 660s;
fastcgi_buffers 64 4K;
# Enable gzip but do not remove ETag headers
gzip on;
gzip_vary on;
gzip_comp_level 4;
gzip_min_length 256;
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
# HTTP response headers borrowed from Nextcloud `.htaccess`
add_header Referrer-Policy "no-referrer" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Download-Options "noopen" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header X-Robots-Tag "none" always;
add_header X-XSS-Protection "1; mode=block" always;
# Remove X-Powered-By, which is an information leak
fastcgi_hide_header X-Powered-By;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
#fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/run/php-fpm8/socket;
fastcgi_pass unix:/run/nextcloud/fastcgi.sock; # From the nextcloud-initscript package
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ {
try_files $uri /index.php$request_uri;
# Optional: Don't log access to other assets
access_log off;
}
# Help pass nextcloud's configuration checks after install:
# Per https://docs.nextcloud.com/server/22/admin_manual/issues/general_troubleshooting.html#service-discovery
location ^~ /.well-known/carddav { return 301 /remote.php/dav/; }
location ^~ /.well-known/caldav { return 301 /remote.php/dav/; }
location ^~ /.well-known/webfinger { return 301 /index.php/.well-known/webfinger; }
location ^~ /.well-known/nodeinfo { return 301 /index.php/.well-known/nodeinfo; }
# Rules borrowed from `.htaccess` to hide certain paths from clients
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; }
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; }
# Ensure this block, which passes PHP files to the PHP process, is above the blocks
# which handle static assets (as seen below). If this block is not declared first,
# then Nginx will encounter an infinite rewriting loop when it prepends `/index.php`
# to the URI, resulting in a HTTP 500 error response.
location ~ \.php(?:$|/) {
# Required for legacy support
rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy) /index.php$request_uri;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
set $path_info $fastcgi_path_info;
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
fastcgi_param HTTPS on;
fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice
fastcgi_param front_controller_active true; # Enable pretty urls
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
fastcgi_max_temp_file_size 0;
}
location ~ \.(?:css|js|svg|gif|png|jpg|ico|wasm|tflite|map)$ {
try_files $uri /index.php$request_uri;
add_header Cache-Control "public, max-age=15778463, $asset_immutable";
access_log off; # Optional: Don't log access to assets
location ~ \.wasm$ {
default_type application/wasm;
}
}
location ~ \.woff2?$ {
try_files $uri /index.php$request_uri;
expires 7d; # Cache-Control policy borrowed from `.htaccess`
access_log off; # Optional: Don't log access to assets
}
# Rule borrowed from `.htaccess`
location /remote {
return 301 /remote.php$request_uri;
}
location / {
try_files $uri $uri/ /index.php$request_uri;
}
}
My php-fpm.conf only has the following line uncommented:
php-fpm.conf
/etc/php8/php-fpm.d/nextcloud.conf:
[global]
error_log = /var/log/nextcloud/php-fpm.log
log_level = warning
emergency_restart_threshold = 10
emergency_restart_interval = 1m
process_control_timeout = 10s
[nextcloud]
user = nextcloud
group = www-data
listen = /run/nextcloud/fastcgi.sock
listen.mode = 0660
pm = ondemand
pm.max_children = 10
pm.process_idle_timeout = 120s
pm.max_requests = 500
pm.status_path =
ping.path = /ping
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
php_admin_flag[file_uploads] = true
php_admin_value[memory_limit] = 512M
php_admin_value[post_max_size] = 513M
php_admin_value[upload_max_filesize] = 513M
php_admin_value[session.save_path] = /var/tmp/nextcloud
php_admin_value[sys_temp_dir] = /var/tmp/nextcloud
php_admin_value[upload_tmp_dir] = /var/tmp/nextcloud
php_admin_flag[log_errors] = on
php_admin_value[error_log] = /var/log/nextcloud/php.error.log
php_admin_value[opcache.error_log] = /var/log/nextcloud/php.error.log
php_admin_flag[output_buffering] = false
php_admin_flag[mbstring.func_overload] = false
php_admin_value[always_populate_raw_post_data] = -1
php_admin_value[disable_functions] = exec,passthru,shell_exec,system,proc_open,curl_multi_exec,show_source
php_admin_flag[opcache.enable] = true
php_admin_flag[opcache.enable_cli] = true
php_admin_flag[opcache.save_comments] = true
php_admin_value[opcache.interned_strings_buffer] = 8
php_admin_value[opcache.max_accelerated_files] = 10000
php_admin_value[opcache.memory_consumption] = 128
php_admin_value[opcache.revalidate_freq] = 1
Please help, I’ve wasted over a week on this and am really mad.