Ubuntu18.04下安装私人网盘服务NextCloud
阿里云国内75折 回扣 微信号:monov8 |
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6 |
一、说明
NextCloud是一款开源免费的私有云存储网盘项目,可以让你快速便捷地搭建一套属于自己或团队的云同步网盘,从而实现跨平台跨设备文件同步、共享、版本控制、团队协作等功能。
不同于公有云盘,私有云盘需要部署在自己的ECS或轻量应用服务器上,并通过公网进行访问,文件传输速度和存储容量取决于您云服务器的硬件配置,传输不限速,安全有保障。
国内外有多种著名的个人云存储,NextCloud是其中之一,本文以NextCloud为例带您从零开始搭建个人云盘。
二、安装准备
NextCloud是php编写的开源项目:
- 需要安装php的运行环境和php-mysq扩展
- 需要一个web服务器,例如apache或nginx,这里我们使用nginx
三、下载NextCloud项目
mkdir /data
cd /data
wget https://download.nextcloud.com/server/releases/nextcloud-16.0.4.zip
unzip nextcloud-16.0.4.zip
cd nextcloud-16.0.4
下载官网:https://nextcloud.com/install/#https://nextcloud.com/install/
四、启动nginx服务器
upstream php-handler {
server 127.0.0.1:9000;
}
server {
listen 80;
server_name 0.0.0.0;
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;
fastcgi_hide_header X-Powered-By;
root /data/nextcloud;
index index.php;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location = /.well-known/carddav {
return 301 $scheme://$host:$server_port/remote.php/dav;
}
location = /.well-known/caldav {
return 301 $scheme://$host:$server_port/remote.php/dav;
}
client_max_body_size 512M;
fastcgi_buffers 64 4K;
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/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 / {
rewrite ^ /index.php$request_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\/.+|oc[ms]-provider\/.+)\.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 modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) {
try_files $uri/ =404;
index index.php;
}
location ~ \.(?:css|js|woff2?|svg|gif|map)$ {
try_files $uri /index.php$request_uri;
add_header Cache-Control "public, max-age=15778463";
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;
access_log off;
}
location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ {
try_files $uri /index.php$request_uri;
access_log off;
}
}
五、在线配置NextCloud
浏览器访问:http://oss.mlxxlm.cn,按照提示一步步安装(主要是配置数据库和初始化超管账号),安装成功后可以见到如下界面
六:可能遇到的问题
问题:在线配置数据库账号,提示失败,一些目录没有权限操作
解决:根据错误提示,把对应没有权限的目录的权限进行调整,使php可以操作对应目录
如果NextCloud请求报错,可以查看nginx和php错误日志,以便于定位问题,nextcloud默认日志在配置的data根目录。
NextCloud操作手册 https://docs.nextcloud.com/server/16/admin_manual/index.html
阿里云国内75折 回扣 微信号:monov8 |
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6 |