nextcloud迁移问题

By Heanny
2024-01-24
265 read

背景

迁移docker下的nextcloud

问题

报错500并且data/nextcloud.log没有日志

大半是mysql没有账户,打开config/config.php查看之前系统配置的mysql账户,使用root账户增加

CREATE USER 'oc_admin2'@'%' IDENTIFIED BY 'password'; -- 创建用户
GRANT ALL PRIVILEGES ON nextcloud.* TO 'oc_admin2'@'%'; -- 分配权限
FLUSH PRIVILEGES; -- 更新权限设置

报错权限问题

要么chmod -R 777 ./*然后在config/config.php中添加

'check_data_directory_permissions' => false

要么

查看用户组
>>> groups www-data
www-data : www-data
修改用户
>>> chown -R www-data:www-data ./*
>>> chmod -R 0770 ./*

nginx配置

server {
        server_name     nextcloud.pi.heanny.cn;
        listen          80;
            # set max upload size and increase upload timeout:
        client_max_body_size 512M;
        client_body_timeout 300s;
        fastcgi_buffers 64 4K;
        add_header Strict-Transport-Security "max-age=15768000;
        includeSubDomains; preload" always;

        # 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;
        location ^~ /.well-known {
                # The rules in this block are an adaptation of the rules
                # in `.htaccess` that concern `/.well-known`.

                location = /.well-known/carddav { return 301 /remote.php/dav/; }
                location = /.well-known/caldav  { return 301 /remote.php/dav/; }

                location /.well-known/acme-challenge    { try_files $uri $uri/ =404; }
                location /.well-known/pki-validation    { try_files $uri $uri/ =404; }

                # Let Nextcloud's API for `/.well-known` URIs handle all other
                # requests by passing them to the front-end controller.
                return 301 /index.php$request_uri;
        }
        location / {
                if ( $http_user_agent ~ ^DavClnt ) {
                        return 302 /remote.php/webdav/$is_args$args;
                }
                proxy_pass http://127.0.0.1:8888;
                proxy_set_header Host $host:80;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

}
[Termux]安卓手机配置nginx

Comments

暂无评论,还不快来坐沙发...

Leave a Reply