日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql bcmod_nextcloud网盘搭建:Ubuntu18.04+Nginx+Mysql

發布時間:2024/7/23 数据库 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql bcmod_nextcloud网盘搭建:Ubuntu18.04+Nginx+Mysql 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

背景

前幾天在windows系統上搭建了一個seafile網盤服務器,在試用時對它的功能還是比較滿意的,有保存文件,共享文件,小組討論和小組文件共享等功能,基本上可以滿足項目式學習的需求。不過在第一節課上課試用時(一個班大概50多人),seafile網盤系統崩了,這也難怪seafile團隊要停止windows server端的更新。于是不得不安裝一個新的網盤系統,下面大概記錄了我安裝網盤的過程及遇到的一些問題。

為了節約資源,我們決定在校內OnlineJudge服務器的基礎上安裝nextcloud,使用8005端口訪問。

安裝軟件

安裝過程

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

用戶管理

總結

以上是生活随笔為你收集整理的mysql bcmod_nextcloud网盘搭建:Ubuntu18.04+Nginx+Mysql的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。