实在对不住各位,由于手头上有两个大标要连续做,三天两头加班加点赶标,现在为止已经整整忙了一个多月了,我们公众号一直是一周发布两次信息,但近段时间实在是没有时间和精力来与大家分享技术,也不知道要讲哪方面的技术了,如果你有想法,写下来发给我,我会抽出时间帮你发布。
此篇文章为技术群里Soul上传的一篇关于Nextcloud的安装教程文章,我认真看完了教程,但我没亲自试验过,总体给我的感觉还是很靠谱的。
Nextcloud干什么用?个人私有云,我们俗称的个人网盘,跟我们之前做的ownCloud教程有很大的关系。2016年4月27日,ownCloud联合创始人Frank Karlitschek宣布离开ownCloud ltc.,转而成立另一家公司“Nextcloud”。由于ownCloud程序本身归其开发人员所有,所以Nextcloud可以直接使用ownCloud的核心技术。
我不想废话了,上主题:十步完成Nextcloud安装
第一步,前期准备
1、利用ssh终端,用命令安装以下必备软件
apt-get installphp5-curl #nexcloud安装必备
apt-get installphp5-gd #nexcloud安装必备
apt-get install zipunzip #zip解压软件
apt-get install wget #安装wget下载
2、建好nextcloud的共享文件夹,我建的位置为/www/nextcloud/
第二步,建立ssl证书。
第三步,安装nginx插件,并完成部署。(需要的扩展内容在最后)
第四步,安装mysql插件。
第五步,利用ssh终端命令下载最新版的nextcloud
wget https://download.nextcloud.com/server/releases/nextcloud-12.0.0.zip
这个地址可以替换,以后有新版本替换成新版的
第六步,解压nexcloud(解压的文件要与下载的一致)
unzip nextcloud-12.0.0.zip
第七步,复制到nginx创建的位置
1、旧版本
cp-r nextcloud/. /media/UUID/www/nextcloud(这个是旧版的文件夹,UUID是有一串英文与数字的文件夹,其他是对应自己创建的目录,新版也是类似,自己修改)
2、新版本
cp-r nextcloud/. /srv/dev-disk-by-id-md-name-localhost-mystor/www/nextcloud
(以上是我的文件夹,你们的在nginx服务器里找nextcloud的就行)
第八步,指定具体文件夹的用户与用户组
cd /media/UUID/www/ chown-R www-data:www-data nextcloud
(这里的www-data:www-data就是具体的用户名和用户组,修改成自己的)
第九步,到共享文件夹acl里用递归先项把nextcloud及子目录的权限修改成,读/写/执行
(不进行这一步操作,很可能在下一步操作后,网页无法找到)
第十步,在浏览器地址栏输入https://ip:端口/nextcloud,完成最后安装。
(需要注意的是,安装时选择文件夹,默认是“nextcloud”,但提示输入“.”就会安装在当前文件夹,因此,当你不改直接点下一步时,以后nextcloud的访问地址是https://ip:端口/nextcloud,而改把默认的nextcloud删了,只输入“.”,访问地址就会是https://ip:端口)
Nginx里需要扩展内容
1、pool(池)里需要的扩展内容
clear_env = no
env[HOSTNAME] =$HOSTNAME
env[PATH] =/usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
2、nextcloud服务器的扩展选项内容
add_headerStrict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
add_headerX-Content-Type-Options nosniff;
add_headerX-Frame-Options "SAMEORIGIN";
add_headerX-XSS-Protection "1; mode=block";
add_headerX-Robots-Tag none;
add_headerX-Download-Options noopen;
add_headerX-Permitted-Cross-Domain-Policies none;
location =/robots.txt {
log_not_found off;
allow all;
access_log off;
}
# The following 2rules are only needed for the user_webfinger app.
# Uncomment it ifyou're planning to use this app.
#rewrite^/.well-known/host-meta /public.php?service=host-meta last;
#rewrite^/.well-known/host-meta.json /public.php?service=host-meta-json
# last;
location =/.well-known/carddav {
return 301$scheme://$host/remote.php/dav;
}
location =/.well-known/caldav {
return 301$scheme://$host/remote.php/dav;
}
# set max uploadsize
client_max_body_size50G;
fastcgi_buffers 644K;
# Disable gzip toavoid the removal of the ETag header
gzip off;
# Uncomment if yourserver is build with the ngx_pagespeed module
# This module iscurrently not supported.
#pagespeed off;
error_page 403/core/templates/403.php;
error_page 404/core/templates/404.php;
location / {
rewrite ^/index.php$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/.+|ocs-provider/.+|core/templates/40[34])\.php(?:$|/){
fastcgi_split_path_info^(.+\.php)(/.*)$;
includefastcgi_params;
fastcgi_paramSCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_paramPATH_INFO $fastcgi_path_info;
fastcgi_param HTTPSon;
#Avoid sending thesecurity headers twice
fastcgi_parammodHeadersAvailable true;
fastcgi_paramfront_controller_active true;
fastcgi_pass$socket;
fastcgi_intercept_errorson;
}
location ~^/(?:updater|ocs-provider)(?:$|/) {
try_files $uri/=404;
index index.php;
}
# Adding the cachecontrol header for js and css files
# Make sure it isBELOW the PHP block
location ~* \.(?:css|js|woff|svg|gif)${
try_files $uri/index.php$uri$is_args$args;
add_headerCache-Control "public, max-age=7200";
add_headerStrict-Transport-Security "max-age=15768000; includeSubDomains;preload;";
add_headerX-Content-Type-Options nosniff;
add_headerX-Frame-Options "SAMEORIGIN";
add_headerX-XSS-Protection "1; mode=block";
add_headerX-Robots-Tag none;
add_headerX-Download-Options noopen;
add_headerX-Permitted-Cross-Domain-Policies none;
# Optional: Don'tlog access to assets
access_log off;
}
location ~*\.(?:png|html|ttf|ico|jpg|jpeg)$ {
try_files $uri/index.php$uri$is_args$args;
# Optional: Don'tlog access to other assets
access_log off;
}