Hi there everyone. I am trying to isntall NextCloud to my home server and running into problems. The error log when I go look in error.log is:
2021/08/11 10:47:37 [error] 144176#144176: *6 FastCGI sent in stderr: "PHP message: PHP Warning: require_once(/var/www/nextcloud/lib/versioncheck.php): failed to open stream: Permission denied in /var/www/nextcloud/index.php on line 31PHP messa
ge: PHP Fatal error: require_once(): Failed opening required '/var/www/nextcloud/lib/versioncheck.php' (include_path='.:/usr/share/php') in /var/www/nextcloud/index.php on line 31" while reading response header from upstream, client: 192.168.1.
2, server: _, request: "GET /nextcloud/ HTTP/2.0", upstream: "fastcgi://127.0.0.1:9999", host: "192.168.1.5"
I have gone to that directory and confirmed that those files are owned by www-data:
root@mail:/var/www/nextcloud/lib# ls -l
total 68
-rw-r-xr-x 1 www-data www-data 5569 Aug 4 15:41 autoloader.php
-rw-r-xr-x 1 www-data www-data 36878 Aug 4 15:41 base.php
drw-r-xr-x 3 www-data www-data 4096 Aug 4 15:41 composer
drw-r-xr-x 2 www-data www-data 4096 Aug 4 15:41 l10n
drw-r-xr-x 63 www-data www-data 4096 Aug 4 15:41 private
drw-r-xr-x 52 www-data www-data 4096 Aug 4 15:41 public
-rw-r-xr-x 1 www-data www-data 1566 Aug 4 15:41 versioncheck.php
Here is also my nextcloud.conf file:
upstream php-handler {
#server 127.0.0.1:9000;
server unix:/var/run/php-fpm.socket;
}
server {
listen 80;
server_name myserver.com;
# enforce https
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name http://myserver.com;
#ssl_certificate /etc/ssl/certs/rapidssl-combined.crt;
#ssl_certificate_key /etc/ssl/private/rapidssl_private.key;
ssl_certificate /etc/letsencrypt/live/myserver.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/myserver.com/privkey.pem;
# Add headers to serve security related headers
# Before enabling Strict-Transport-Security headers please read into this
# topic first.
#add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options "SAMEORIGIN";
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;
# Path to the root of your installation
root /var/www/;
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 /nextcloud/public.php?service=host-meta
# last;
#rewrite ^/.well-known/host-meta.json
# /nextcloud/public.php?service=host-meta-json last;
location = /.well-known/carddav {
return 301 $scheme://$host/nextcloud/remote.php/dav;
}
location = /.well-known/caldav {
return 301 $scheme://$host/nextcloud/remote.php/dav;
}
location /.well-known/acme-challenge { }
location ^~ /nextcloud {
# set max upload size
client_max_body_size 512M;
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;
location /nextcloud {
rewrite ^ /nextcloud/index.php$uri;
}
location ~ ^/nextcloud/(?:build|tests|config|lib|3rdparty|templates|data)/ {
deny all;
}
location ~ ^/nextcloud/(?:\.|autotest|occ|issue|indie|db_|console) {
deny all;
}
location ~ ^/nextcloud/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/temp
lates/40[34])\.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS on;
#Avoid sending the security headers twice
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ ^/nextcloud/(?: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|woff|svg|gif)$ {
try_files $uri /nextcloud/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)
# Before enabling Strict-Transport-Security headers please read
# into this topic first.
# add_header Strict-Transport-Security "max-age=15768000;
# includeSubDomains; preload;";
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options "SAMEORIGIN";
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;
# Optional: Don't log access to assets
access_log off;
}
location ~* \.(?:png|html|ttf|ico|jpg|jpeg)$ {
try_files $uri /nextcloud/index.php$uri$is_args$args;
# Optional: Don't log access to other assets
access_log off;
}
# location ~ \.php$ {
# include snippets/fastcgi-php.conf;
# fastcgi_pass unix:/run/php/php7.2-fpm.sock;
# }
}
}
I’m sorry I have searched but I can’t find a solution for this error.
Thankyou.