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

        歡迎訪問 生活随笔!

        生活随笔

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

        linux

        Linux安装nextcloud教程,Ubuntu安装NextCloud

        發布時間:2024/3/26 linux 46 豆豆
        生活随笔 收集整理的這篇文章主要介紹了 Linux安装nextcloud教程,Ubuntu安装NextCloud 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

        NextCloud(https://nextcloud.com/)是開源的、可以用來搭建自己的文件同步和共享的私有云服務器,它是ownCloud的一個分支。

        我使用LEMP做為NextCloud的運行環境-MariaDB, PHP-FPM 和 Nginx(Ubuntu 16.04)。

        1、安裝MariaDB

        Ubuntu 16.04 安裝 MariaDB

        首先,更新升級系統:

        $ sudo apt update

        $ sudo apt upgrade

        安裝MariaDB:

        $ sudo apt install mariadb-server

        啟動MariaDB服務:

        $ sudo systemctl start mysql

        查看狀態:

        $ sudo systemctl status mysql

        為例提高MariaDB的安全,我們可以執行初始化安全腳本:

        $ sudo mysql_secure_installation

        默認root密碼為空;然后設置root密碼和其他選項:

        - Set root password? [Y/n] y

        - Remove anonymous users? [Y/n] y

        - Disallow root login remotely? [Y/n] y

        - Remove test database and access to it? [Y/n] y

        - Reload privilege tables now? [Y/n] y

        登陸MariaDB命令行:

        $ sudo mysql -u root -p

        2、為NextCloud創建一個數據庫和用戶

        $ sudo mysql -u root -p

        MariaDB [(none)]> CREATE DATABASE nextcloud;

        MariaDB [(none)]> GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost' IDENTIFIED BY 'test1234';

        MariaDB [(none)]> FLUSH PRIVILEGES;

        MariaDB [(none)]> \q

        創建數據庫nextcloud;用戶名nextcloud,密碼test1234。

        3、安裝PHP和相關模塊

        $ sudo apt-get -y install php-fpm php-cli php-json php-curl php-imap php-gd php-mysql php-xml php-zip php-intl php-mcrypt php-imagick php-mbstring

        配置PHP:

        $ sudo sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/7.0/fpm/php.ini

        $ sudo sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.0/fpm/php.ini

        $ sudo sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=1/" /etc/php/7.0/fpm/php.ini

        $ sudo sed -i "s/upload_max_filesize = .*/upload_max_filesize = 200M/" /etc/php/7.0/fpm/php.ini

        $ sudo sed -i "s/post_max_size = .*/post_max_size = 200M/" /etc/php/7.0/fpm/php.ini

        重啟PHP-FPM:

        $ sudo systemctl restart php7.0-fpm

        4、下載NextCloud

        下載地址:https://download.nextcloud.com/server/releases/,我安裝時最新版本是9.0.52。

        $ cd /tmp

        $ wget https://download.nextcloud.com/server/releases/nextcloud-9.0.52.zip

        解壓到/var/www/目錄并更改權限:

        $ unzip nextcloud-9.0.52.zip

        $ sudo mkdir /var/www/

        $ sudo mv nextcloud /var/www/

        $ sudo chown -R www-data: /var/www/nextcloud

        5、安裝配置Nginx

        $ sudo apt-get install nginx nginx-extras

        生成自簽名證書:

        $ sudo mkdir -p /etc/nginx/ssl

        $ cd /etc/nginx/ssl

        $ sudo openssl genrsa -des3 -passout pass:x -out nextcloud.pass.key 2048

        $ sudo openssl rsa -passin pass:x -in nextcloud.pass.key -out nextcloud.key

        $ sudo rm nextcloud.pass.key

        $ sudo openssl req -new -key nextcloud.key -out nextcloud.csr

        $ sudo openssl x509 -req -days 365 -in nextcloud.csr -signkey nextcloud.key -out nextcloud.crt

        也可以使用免費的let encrypt。

        創建Nginx server block文件:

        $ sudo vim /etc/nginx/sites-available/nextcloud

        server {

        listen 80;

        server_name nextcloud.topspeedsnail.com;

        return 301 https://$server_name$request_uri;

        }

        server {

        listen 443 ssl http2;

        server_name nextcloud.topspeedsnail.com;

        root /var/www/nextcloud;

        ssl on;

        ssl_certificate /etc/nginx/ssl/nextcloud.crt;

        ssl_certificate_key /etc/nginx/ssl/nextcloud.key;

        ssl_session_timeout 5m;

        ssl_ciphers ? 'AES128+EECDH:AES128+EDH:!aNULL';

        ssl_protocols ?TLSv1 TLSv1.1 TLSv1.2;

        ssl_prefer_server_ciphers on;

        add_header X-Content-Type-Options nosniff;

        add_header X-Frame-Options "SAMEORIGIN";

        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;

        access_log ?/var/log/nginx/nextcloud.access.log;

        error_log ? /var/log/nginx/nextcloud.error.log;

        location = /robots.txt {

        allow all;

        log_not_found off;

        access_log off;

        }

        location = /.well-known/carddav {

        return 301 $scheme://$host/remote.php/dav;

        }

        location = /.well-known/caldav {

        return 301 $scheme://$host/remote.php/dav;

        }

        client_max_body_size 512M;

        fastcgi_buffers 64 4K;

        gzip 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(?:$|/) {

        include fastcgi_params;

        fastcgi_split_path_info ^(.+\.php)(/.+)$;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        fastcgi_param PATH_INFO $fastcgi_path_info;

        fastcgi_param HTTPS on;

        #Avoid sending the security headers twice

        fastcgi_param modHeadersAvailable true;

        fastcgi_param front_controller_active true;

        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;

        fastcgi_intercept_errors on;

        fastcgi_request_buffering off;

        }

        location ~ ^/(?:updater|ocs-provider)(?:$|/) {

        try_files $uri/ =404;

        index index.php;

        }

        location ~* \.(?:css|js)$ {

        try_files $uri /index.php$uri$is_args$args;

        add_header Cache-Control "public, max-age=7200";

        add_header X-Content-Type-Options nosniff;

        add_header X-Frame-Options "SAMEORIGIN";

        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;

        # Optional: Don't log access to assets

        access_log off;

        }

        location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ {

        try_files $uri /index.php$uri$is_args$args;

        access_log off;

        }

        location ~ /\.ht {

        deny all;

        }

        }

        注意替換上面的域名。

        創建鏈接:

        $ sudo ln -s /etc/nginx/sites-available/nextcloud /etc/nginx/sites-enabled/nextcloud

        測試Nginx配置文件:

        $ sudo nginx -t

        重啟nginx:

        $ sudo systemctl restart nginx

        6、完成安裝

        使用瀏覽器訪問 https://your_domain_or_IP;

        設置管理員賬戶和數據庫:

        總結

        以上是生活随笔為你收集整理的Linux安装nextcloud教程,Ubuntu安装NextCloud的全部內容,希望文章能夠幫你解決所遇到的問題。

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