背景
前幾天在windows系統上搭建了一個seafile網盤服務器,在試用時對它的功能還是比較滿意的,有保存檔案,共享檔案,小組討論和小組檔案共享等功能,基本上可以滿足專案式學習的需求,不過在第一節課上課試用時(一個班大概50多人),seafile網盤系統崩了,這也難怪seafile團隊要停止windows server端的更新,于是不得不安裝一個新的網盤系統,下面大概記錄了我安裝網盤的程序及遇到的一些問題,
為了節約資源,我們決定在校內OnlineJudge服務器的基礎上安裝nextcloud,使用8005埠訪問,
安裝軟體
在下載nextcloud檔案之前,檢查相關的軟體版本和作業系統版本是否符合要求,我使用的是系統和軟體是:Ubuntu 18.04+MySQL +Nginx
參考鏈接:https://docs.nextcloud.com/server/19/admin_manual/installation/system_requirements.html
安裝程序
1.在/home/judge/src/目錄下下載檔案并解壓檔案,網站的根目錄自己定,
wget https://download.nextcloud.com/server/releases/nextcloud-19.0.2.zip
unzip nextcloud-19.0.2.zip
2.設定檔案夾的訪問權限可以被nginx訪問
chown -R www-data:www-data /home/judge/src/nextcloud
3.登錄mysql,新建nextcloud資料庫,新建用戶并賦予其用戶訪問資料庫的權限,
4.修改nginx組態檔
在 /etc/nginx/sites-enabled/目錄下新建nextcloud組態檔,因為是在內網訪問,只是上課的時候使用,安全要求不高,因此去掉了htpps連接的相關配置,
下面的配置參考了官方的配置引數,官方的配置引數可查看鏈接:https://docs.nextcloud.com/server/19/admin_manual/installation/nginx.html
參考配置如下:
upstream php-handler {
server 127.0.0.1:9000;
#server unix:/var/run/php/php7.4-fpm.sock;
}
server {
listen 8005;
server_name default_server;
index index.html index.htm index.php default.html default.htm default.php;
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;
fastcgi_hide_header X-Powered-By;
root /home/judge/src/nextcloud;
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;
}
location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
deny all;
}
location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) {
deny all;
}
location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) {
try_files $uri/ =404;
index index.php;
}
location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy)\.php(?:$|\/) {
fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
set $path_info $fastcgi_path_info;
try_files $fastcgi_script_name =404;
include fastcgi_params;
#include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ \.(?:css|js|woff2?|svg|gif|map)$ {
try_files $uri /index.php$request_uri;
add_header Cache-Control "public, max-age=15778463";
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;
# Optional: Don't log access to assets
access_log off;
}
location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap|mp4|webm)$ {
try_files $uri /index.php$request_uri;
access_log off;
}
}
保存之后重啟nginx:
service nginx restart
訪問http://ipaddress:8005,順利的話這時會跳轉到nextcloud的安裝頁面,在安裝頁面輸入管理員的賬號和密碼,還有前面已經設定好的,用于訪問資料庫的用戶名、密碼和資料庫名稱,選擇安裝即可,
可能出會出的錯誤
錯誤 1:內部服務器錯誤(Internal Server Error)
可以通過查看nginx服務器error_log來判斷,error_log保存的位置在nginx.conf檔案中可以找到,如我的nginx服務器日志的保存位置為:/var/log/nginx/error.log
通過查看日志,原因是nginx無法在網站目錄下創建檔案,重新給nginx賦予權限就行,
錯誤2:504 Gateway Time-out
因為nextcloud的服務器在國外,訪問速度較慢,在安裝一些app時可能會出現這個錯誤,可以修改nginx的keepalive_timeout引數,
keepalive_timeout 3600;
nextcloud的功能很豐富,除了基本的網盤功能,還可以安裝很多app,如制作思維導圖的mindMap,用于線上聊天的talk,用于在線辦公的collaboraoffice,這些功能極大地滿足新教材里面所要求的專案式教學,
國內連接到nextcloud的服務器比較慢,也可以選擇把安裝包下載下再手動安裝,具體程序可參考:https://www.jianshu.com/p/24f66d0d2660
部分功能展示
1.登錄之后的主頁面

2.Talk App,可以建立群組討論,可以上傳或共享檔案,

3.線上思維導圖APP

用戶管理
nextcloud不支持批量匯入用戶,有需要批量匯入的朋友請查看我的另一篇blog,地址:https://blog.csdn.net/Zerotogether/article/details/108547747.
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/34769.html
標籤:其他
下一篇:IT 必備網站
