{"id":84320,"date":"2024-03-29T14:29:31","date_gmt":"2024-03-29T06:29:31","guid":{"rendered":"https:\/\/docs.pingcode.com\/?p=84320"},"modified":"2024-03-29T14:29:31","modified_gmt":"2024-03-29T06:29:31","slug":"linux%e4%b8%ad%e5%a6%82%e4%bd%95%e5%ae%89%e8%a3%85%e5%92%8c%e9%85%8d%e7%bd%aenextcloud%e7%a7%81%e6%9c%89%e4%ba%91","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/84320.html","title":{"rendered":"Linux\u4e2d\u5982\u4f55\u5b89\u88c5\u548c\u914d\u7f6eNextcloud\u79c1\u6709\u4e91"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2024\/03\/uploading_images2024-03-19_18-03-39_6738.png?x-oss-process=image\/auto-orient,1\/format,webp\" alt=\"Linux\u4e2d\u5982\u4f55\u5b89\u88c5\u548c\u914d\u7f6eNextcloud\u79c1\u6709\u4e91\" \/><\/p>\n<p>\u6784\u5efa\u60a8\u81ea\u5df1\u7684\u79c1\u6709\u4e91\u670d\u52a1\u5668\u4f7f\u60a8\u80fd\u591f\u5b58\u50a8\u3001\u540c\u6b65\u548c\u5171\u4eab\u6570\u636e\uff0c\u800c\u4e0d\u5fc5\u4f9d\u8d56\u7b2c\u4e09\u65b9\u4e91\u670d\u52a1\u63d0\u4f9b\u5546\u3002<strong>Nextcloud<\/strong>\u662f\u4e00\u6b3e\u5f00\u6e90\u7684\u79c1\u6709\u4e91\u5b58\u50a8\u89e3\u51b3\u65b9\u6848\uff0c\u5b83\u80fd\u591f\u5728Linux\u7cfb\u7edf\u4e2d\u5b89\u88c5\u548c\u8fd0\u884c\u3002\u7528\u6237\u53ef\u4ee5\u901a\u8fc7\u5176\u5b89\u88c5\u5728<strong>Linux\u670d\u52a1\u5668\u4e0a\u3001\u914d\u7f6eSSL\u5b89\u5168\u901a\u4fe1\u3001\u4ee5\u53ca\u4f7f\u7528\u6570\u636e\u5e93\u540e\u53f0\u8fdb\u884c\u6570\u636e\u5b58\u50a8\uff0c\u4ece\u800c\u5f97\u5230\u4e00\u4e2a\u529f\u80fd\u5b8c\u5584\u7684\u79c1\u6709\u4e91\u670d\u52a1<\/strong>\u3002\u5176\u4e2d\uff0c\u914d\u7f6eSSL\u5b89\u5168\u901a\u4fe1\u662f\u5173\u952e\u6b65\u9aa4\u4e4b\u4e00\uff0c\u56e0\u4e3a\u5b83\u786e\u4fdd\u4e86\u6570\u636e\u5728\u4f20\u8f93\u8fc7\u7a0b\u4e2d\u7684\u52a0\u5bc6\uff0c\u4ece\u800c\u63d0\u9ad8\u4e86\u6574\u4f53\u7cfb\u7edf\u7684\u5b89\u5168\u6027\u3002<\/p>\n<h2><strong>\u4e00\u3001\u5b89\u88c5LAMP\u73af\u5883<\/strong><\/h2>\n<p>\u5728\u5f00\u59cb\u5b89\u88c5Nextcloud\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u5728Linux\u7cfb\u7edf\u4e0a\u5b89\u88c5LAMP\uff08Linux, Apache, MySQL\/MariaDB, PHP\uff09\u5806\u6808\u3002<\/p>\n<p><strong>\u5b89\u88c5Apache Web\u670d\u52a1\u5668\uff1a<\/strong><\/p>\n<p>&#8220;`sh<\/p>\n<p>sudo apt update<\/p>\n<p>sudo apt install apache2<\/p>\n<p>&#8220;`<\/p>\n<p>\u5b89\u88c5\u540e\uff0c\u542f\u52a8Apache\u5e76\u8bbe\u7f6e\u4e3a\u5f00\u673a\u542f\u52a8\u3002<\/p>\n<p>&#8220;`sh<\/p>\n<p>sudo systemctl start apache2<\/p>\n<p>sudo systemctl enable apache2<\/p>\n<p>&#8220;`<\/p>\n<p><strong>\u5b89\u88c5MariaDB\u6570\u636e\u5e93\uff1a<\/strong><\/p>\n<p>&#8220;`sh<\/p>\n<p>sudo apt install mariadb-server mariadb-client<\/p>\n<p>&#8220;`<\/p>\n<p>\u540c\u6837\uff0c\u542f\u52a8\u670d\u52a1\u5e76\u8bbe\u7f6e\u5f00\u673a\u542f\u52a8\uff0c\u5e76\u8fdb\u884c\u5b89\u5168\u8bbe\u7f6e\u3002<\/p>\n<p>&#8220;`sh<\/p>\n<p>sudo systemctl start mariadb<\/p>\n<p>sudo systemctl enable mariadb<\/p>\n<p>sudo mysql_secure_installation<\/p>\n<p>&#8220;`<\/p>\n<p><strong>\u5b89\u88c5PHP\u53ca\u5176\u6269\u5c55\u5305\uff1a<\/strong><\/p>\n<p>&#8220;`sh<\/p>\n<p>sudo apt install php libapache2-mod-php php-mysql php-gd php-json php-curl php-mbstring php-intl php-imagick php-xml php-zip<\/p>\n<p>&#8220;`<\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u8c03\u6574PHP\u7684\u4e00\u4e9b\u8bbe\u7f6e\u4ee5\u4f18\u5316Nextcloud\u7684\u6027\u80fd\u3002<\/p>\n<h2><strong>\u4e8c\u3001\u521b\u5efaNextcloud\u6570\u636e\u5e93<\/strong><\/h2>\n<p>\u4f7f\u7528MariaDB\u521b\u5efa\u4e00\u4e2a\u4e13\u7528\u7684\u6570\u636e\u5e93\u548c\u7528\u6237\uff0c\u8fd9\u6837\u53ef\u4ee5\u63d0\u9ad8\u5b89\u5168\u6027\uff0c\u4e14\u65b9\u4fbf\u8fdb\u884c\u7ba1\u7406\u3002<\/p>\n<p>&#8220;`sh<\/p>\n<p>sudo mysql -u root -p<\/p>\n<p>CREATE DATABASE nextcloud;<\/p>\n<p>CREATE USER &#8216;nextclouduser&#8217;@&#8217;localhost&#8217; IDENTIFIED BY &#8216;StrongPassword&#8217;;<\/p>\n<p>GRANT ALL PRIVILEGES ON nextcloud.* TO &#8216;nextclouduser&#8217;@&#8217;localhost&#8217;;<\/p>\n<p>FLUSH PRIVILEGES;<\/p>\n<p>EXIT;<\/p>\n<p>&#8220;`<\/p>\n<p><strong>\u5176\u4e2d\uff0c&#8217;StrongPassword&#8217;\u5e94\u66ff\u6362\u4e3a\u4e00\u4e2a\u5f3a\u5bc6\u7801\u3002<\/strong><\/p>\n<h2><strong>\u4e09\u3001\u4e0b\u8f7d\u5e76\u914d\u7f6eNextcloud<\/strong><\/h2>\n<p>\u8bbf\u95eeNextcloud\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u6700\u65b0\u7684Nextcloud\u5b89\u88c5\u5305\u3002<\/p>\n<p>&#8220;`sh<\/p>\n<p>wget https:\/\/download.nextcloud.com\/server\/releases\/nextcloud-XX.YY.ZZ.zip<\/p>\n<p>&#8220;`<\/p>\n<p><strong>XX.YY.ZZ<\/strong>\u5e94\u66ff\u6362\u4e3a\u6700\u65b0\u7248\u672c\u53f7\u3002\u89e3\u538b\u5b89\u88c5\u5305\u5e76\u5c06Nextcloud\u6587\u4ef6\u653e\u5230\u7f51\u7ad9\u76ee\u5f55\u3002<\/p>\n<p>&#8220;`sh<\/p>\n<p>unzip nextcloud-XX.YY.ZZ.zip<\/p>\n<p>sudo mv nextcloud \/var\/www\/html\/<\/p>\n<p>&#8220;`<\/p>\n<p>\u7136\u540e\uff0c\u8bbe\u7f6e\u6587\u4ef6\u6743\u9650\uff0c\u786e\u4fddNextcloud\u80fd\u591f\u6b63\u5e38\u8fd0\u884c\u3002<\/p>\n<p>&#8220;`sh<\/p>\n<p>sudo chown -R www-data:www-data \/var\/www\/html\/nextcloud\/<\/p>\n<p>sudo chmod -R 755 \/var\/www\/html\/nextcloud\/<\/p>\n<p>&#8220;`<\/p>\n<h2><strong>\u56db\u3001\u914d\u7f6eApache\u865a\u62df\u4e3b\u673a\u4e0eSSL<\/strong><\/h2>\n<p>\u4e3a\u4e86\u8ba9Nextcloud\u901a\u8fc7Web\u8bbf\u95ee\uff0c\u9700\u8981\u914d\u7f6eApache\u865a\u62df\u4e3b\u673a\u3002<\/p>\n<p>\u521b\u5efa\u4e00\u4e2a\u914d\u7f6e\u6587\u4ef6`nextcloud.conf`\uff1a<\/p>\n<p>&#8220;`sh<\/p>\n<p>sudo nano \/etc\/apache2\/sites-av<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>lable\/nextcloud.conf<\/p>\n<p>&#8220;`<\/p>\n<p>\u6dfb\u52a0\u4ee5\u4e0b\u914d\u7f6e\u6307\u4ee4\u5e76\u4fdd\u5b58\uff1a<\/p>\n<p>&#8220;`apache<\/p>\n<p><VirtualHost *:80><\/p>\n<p>    ServerAdmin admin@example.com<\/p>\n<p>    DocumentRoot \/var\/www\/html\/nextcloud\/<\/p>\n<p>    ServerName your-domain.com<\/p>\n<p>    Alias \/nextcloud &#8220;\/var\/www\/html\/nextcloud\/&#8221;<\/p>\n<p>    <Directory \/var\/www\/html\/nextcloud\/><\/p>\n<p>        Options +FollowSymlinks<\/p>\n<p>        AllowOverride All<\/p>\n<p>        Require all granted<\/p>\n<p>        <IfModule mod_dav.c><\/p>\n<p>            Dav off<\/p>\n<p>        <\/IfModule><\/p>\n<p>    <\/Directory><\/p>\n<p>    ErrorLog ${APACHE_LOG_DIR}\/nextcloud_error.log<\/p>\n<p>    CustomLog ${APACHE_LOG_DIR}\/nextcloud_access.log combined<\/p>\n<p><\/VirtualHost><\/p>\n<p>&#8220;`<\/p>\n<p><strong>&#8216;your-domain.com&#8217;<\/strong> \u5e94\u66ff\u6362\u4e3a\u60a8\u81ea\u5df1\u7684\u57df\u540d\u3002\u542f\u7528\u8be5\u865a\u62df\u4e3b\u673a\u5e76\u91cd\u542fApache\u670d\u52a1\u3002<\/p>\n<p>&#8220;`sh<\/p>\n<p>sudo a2ensite nextcloud<\/p>\n<p>sudo systemctl restart apache2<\/p>\n<p>&#8220;`<\/p>\n<p>\u63a5\u7740\uff0c\u914d\u7f6eSSL\u4ee5\u542f\u7528HTTPS\u3002\u53ef\u4ee5\u4f7f\u7528Let&#8217;s Encrypt\u514d\u8d39\u83b7\u53d6SSL\u8bc1\u4e66\u3002<\/p>\n<p>&#8220;`sh<\/p>\n<p>sudo apt install certbot python3-certbot-apache<\/p>\n<p>sudo certbot &#8211;apache -d your-domain.com<\/p>\n<p>&#8220;`<\/p>\n<p>\u9075\u5faa\u63d0\u793a\u5b8c\u6210SSL\u8bc1\u4e66\u5b89\u88c5\uff0cCertbot\u4f1a\u81ea\u52a8\u66f4\u65b0\u60a8\u7684Apache\u914d\u7f6e\u4ee5\u4f7f\u7528HTTPS\u3002<\/p>\n<h2><strong>\u4e94\u3001\u5b8c\u6210Nextcloud\u5b89\u88c5<\/strong><\/h2>\n<p>\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95ee\u60a8\u7684\u57df\u540d\u6216\u670d\u52a1\u5668IP\u5730\u5740\uff0c\u5b8c\u6210\u5b89\u88c5\u5411\u5bfc\u3002\u60a8\u9700\u8981\u521b\u5efa\u7ba1\u7406\u5458\u8d26\u53f7\uff0c\u5e76\u586b\u5199\u6570\u636e\u5e93\u7684\u8be6\u7ec6\u4fe1\u606f\u3002<\/p>\n<h2><strong>\u516d\u3001\u4f18\u5316\u4e0e\u989d\u5916\u914d\u7f6e<\/strong><\/h2>\n<p><strong>\u914d\u7f6e\u7f13\u5b58\uff1a<\/strong><\/p>\n<p>\u4e3a\u4e86\u63d0\u9ad8\u6027\u80fd\uff0c\u5b89\u88c5\u5e76\u914d\u7f6ePHP\u7f13\u5b58\u5de5\u5177\uff0c\u5982Redis\u6216Memcached\u3002<\/p>\n<p>&#8220;`sh<\/p>\n<p>sudo apt install redis-server php-redis<\/p>\n<p>&#8220;`<\/p>\n<p>\u4fee\u6539Nextcloud\u914d\u7f6e\u6587\u4ef6`config.php`\uff0c\u6dfb\u52a0\u7f13\u5b58\u914d\u7f6e\u3002<\/p>\n<p><strong>\u7ef4\u62a4\u4e0e\u66f4\u65b0\uff1a<\/strong><\/p>\n<p>\u4fdd\u6301Nextcloud\u53ca\u5176\u4f9d\u8d56\u9879\u66f4\u65b0\u81f3\u6700\u65b0\u7248\u672c\uff0c\u4ee5\u786e\u4fdd\u5b89\u5168\u6027\u548c\u6700\u4f73\u6027\u80fd\u3002<\/p>\n<p>\u6700\u540e\uff0c\u901a\u8fc7\u5b9a\u671f\u5907\u4efd\u60a8\u7684\u6570\u636e\u548c\u6570\u636e\u5e93\uff0c\u786e\u4fdd\u5728\u51fa\u73b0\u95ee\u9898\u65f6\u60a8\u53ef\u4ee5\u5feb\u901f\u6062\u590d\u670d\u52a1\u3002_nextcloud\u63d0\u4f9b\u5f3a\u5927\u7684\u63d2\u4ef6\u7cfb\u7edf\uff0c\u53ef\u4ee5\u6269\u5c55\u5176\u6838\u5fc3\u529f\u80fd\uff0c\u5982\u65e5\u5386\u3001\u8054\u7cfb\u4eba\u540c\u6b65\u548c\u89c6\u9891\u4f1a\u8bae\u529f\u80fd\uff0c\u60a8\u53ef\u4ee5\u6839\u636e\u9700\u8981\u5b89\u88c5\u8fd9\u4e9b\u63d2\u4ef6\uff0c\u8fdb\u4e00\u6b65\u589e\u5f3a\u60a8\u7684\u79c1\u6709\u4e91\u670d\u52a1\u5668\u7684\u529f\u80fd\u3002<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>\u5982\u4f55\u5728Linux\u7cfb\u7edf\u4e0a\u5b89\u88c5Nextcloud\u79c1\u6709\u4e91\uff1f<\/strong><\/p>\n<p>\u8981\u5728Linux\u7cfb\u7edf\u4e0a\u5b89\u88c5Nextcloud\u79c1\u6709\u4e91\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u5df2\u7ecf\u5b89\u88c5\u4e86Apache\u3001MySQL\u548cPHP\u7b49\u5fc5\u8981\u7684\u8f6f\u4ef6\u5305\u3002\u7136\u540e\uff0c\u4eceNextcloud\u5b98\u65b9\u7f51\u7ad9\u4e0a\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u7684Nextcloud\u538b\u7f29\u5305\uff0c\u5e76\u89e3\u538b\u5230Apache\u7684\u7f51\u7ad9\u6839\u76ee\u5f55\u3002\u63a5\u7740\uff0c\u8bbe\u7f6e\u6b63\u786e\u7684\u6587\u4ef6\u6743\u9650\u5e76\u914d\u7f6eApache\uff0c\u786e\u4fddNextcloud\u53ef\u4ee5\u6b63\u5e38\u8fd0\u884c\u3002<\/p>\n<p><strong>Nextcloud\u79c1\u6709\u4e91\u9700\u8981\u600e\u6837\u7684\u7cfb\u7edf\u914d\u7f6e\uff1f<\/strong><\/p>\n<p>\u4e3a\u4e86\u786e\u4fddNextcloud\u79c1\u6709\u4e91\u7684\u6d41\u7545\u8fd0\u884c\uff0c\u7cfb\u7edf\u9700\u8981\u6ee1\u8db3\u4e00\u5b9a\u7684\u786c\u4ef6\u548c\u8f6f\u4ef6\u914d\u7f6e\u8981\u6c42\u3002\u901a\u5e38\u5efa\u8bae\u81f3\u5c11 1GB \u7684\u5185\u5b58\u548c 16GB \u7684\u78c1\u76d8\u7a7a\u95f4\uff0c\u4ee5\u53ca\u8f83\u65b0\u7248\u672c\u7684 Apache\u3001MySQL\/MariaDB \u548c PHP\u3002\u6b64\u5916\uff0c\u5efa\u8bae\u542f\u7528SSL \u52a0\u5bc6\u8fde\u63a5\u4ee5\u589e\u5f3a\u6570\u636e\u5b89\u5168\u6027\uff0c\u540c\u65f6\u5b9a\u671f\u5907\u4efd\u6570\u636e\u4ee5\u9632\u6570\u636e\u4e22\u5931\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Linux\u7cfb\u7edf\u4e0a\u914d\u7f6eNextcloud\u79c1\u6709\u4e91\u7684\u5916\u90e8\u8bbf\u95ee\uff1f<\/strong><\/p>\n<p>\u8981\u5728Linux\u7cfb\u7edf\u4e0a\u914d\u7f6eNextcloud\u79c1\u6709\u4e91\u7684\u5916\u90e8\u8bbf\u95ee\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u5df2\u7ecf\u8bbe\u7f6e\u4e86\u6b63\u786e\u7684\u57df\u540d\u89e3\u6790\u548c\u7aef\u53e3\u8f6c\u53d1\u3002\u7136\u540e\uff0c\u7f16\u8f91Nextcloud\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u4fee\u6539\u2018trusted_domains\u2019\u53c2\u6570\u4ee5\u6dfb\u52a0\u57df\u540d\u3002\u63a5\u7740\uff0c\u5728Web\u670d\u52a1\u5668\u914d\u7f6e\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u6b63\u786e\u7684\u865a\u62df\u4e3b\u673a\u914d\u7f6e\uff0c\u5e76\u91cd\u65b0\u52a0\u8f7dWeb\u670d\u52a1\u5668\u3002\u6700\u540e\uff0c\u5728\u9632\u706b\u5899\u4e2d\u5141\u8bb8\u76f8\u5e94\u7684\u7aef\u53e3\u8bbf\u95ee\u3002\u8fd9\u6837\uff0c\u5c31\u53ef\u4ee5\u901a\u8fc7\u5916\u90e8\u7f51\u7edc\u8bbf\u95ee\u5230Nextcloud\u79c1\u6709\u4e91\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u6784\u5efa\u60a8\u81ea\u5df1\u7684\u79c1\u6709\u4e91\u670d\u52a1\u5668\u4f7f\u60a8\u80fd\u591f\u5b58\u50a8\u3001\u540c\u6b65\u548c\u5171\u4eab\u6570\u636e\uff0c\u800c\u4e0d\u5fc5\u4f9d\u8d56\u7b2c\u4e09\u65b9\u4e91\u670d\u52a1\u63d0\u4f9b\u5546\u3002Nextcloud\u662f\u4e00\u6b3e\u5f00 [&hellip;]","protected":false},"author":1,"featured_media":84321,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[384],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/84320"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=84320"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/84320\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/84321"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=84320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=84320"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=84320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}