{"id":237,"date":"2024-11-23T21:44:44","date_gmt":"2024-11-23T13:44:44","guid":{"rendered":"https:\/\/zhzxs.asia\/?p=237"},"modified":"2025-01-08T22:36:42","modified_gmt":"2025-01-08T14:36:42","slug":"1732369825","status":"publish","type":"post","link":"https:\/\/www.zhzxs.site\/index.php\/2024\/11\/23\/1732369825\/","title":{"rendered":"\u534e\u4e3aubuntu22.04\u547d\u4ee4\u884c\u642d\u5efanextcloud"},"content":{"rendered":"\n<p>\u672c\u6587\u7ae0\u662f\u5728\u7d27\u968f\u7740\u4e0a\u4e00\u7bc7\u6587\u7ae0<a href=\"https:\/\/www.zhzxs.site\/index.php\/2024\/11\/23\/1732368731\/\">https:\/\/www.zhzxs.site\/index.php\/2024\/11\/23\/1732368731\/<\/a>\u5728\u6210\u529f\u5b89\u88c5 WordPress \u7684\u57fa\u7840\u4e0a\uff0c\u7ee7\u7eed\u5b89\u88c5Nextcloud \u7684\uff0c\u6240\u4ee5\u8fc7\u7a0b\u4e5f\u53ef\u4ee5\u4f7f\u7528 Apache \u4f5c\u4e3a Web \u670d\u52a1\u3002nextcloud php \u7248\u672c\u9700\u89818.1\u4ee5\u4e0a\u7684 \u4ee5\u4e0b\u662f\u8be6\u7ec6\u6b65\u9aa4\uff1a<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. \u5b89\u88c5 Nextcloud \u7684\u524d\u7f6e\u6761\u4ef6<\/strong><\/h3>\n\n\n\n<p>Nextcloud \u9700\u8981 LAMP \u73af\u5883\uff0c\u5176\u4e2d Apache \u548c PHP\u4ee5\u53caMysql \u5df2\u7ecf\u5b89\u88c5\uff0c\u82e5\u6ca1\u5b89\u88c5\u8bf7\u53c2\u8003\u9760<a href=\"https:\/\/www.zhzxs.site\/index.php\/2024\/11\/23\/1732368731\/\">https:\/\/www.zhzxs.site\/index.php\/2024\/11\/23\/1732368731\/<\/a> \u5c06Apaceh,PHP,Musql\u5b89\u88c5\u4e0a\u3002<\/p>\n\n\n\n<p>\u7136\u540e\u53ea\u9700\u786e\u4fdd\u4ee5\u4e0b PHP \u6269\u5c55\u548c\u914d\u7f6e\uff1a<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u5b89\u88c5\u6240\u9700\u7684 PHP \u6269\u5c55<\/h4>\n\n\n\n<p>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo apt update<br>sudo apt install php-bz2 php-intl php-gmp php-bcmath php-imagick php-ldap php-common php-curl php-xml php-mbstring php-zip php-apcu php-cli -y<br><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u786e\u8ba4 PHP \u7248\u672c<\/h4>\n\n\n\n<p>Nextcloud \u5bf9 PHP \u7248\u672c\u6709\u8981\u6c42\uff08\u63a8\u8350 PHP 8.1 \u4ee5\u4e0a\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u786e\u8ba4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>php -v<br><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u5b89\u88c5\u5176\u4ed6\u4f9d\u8d56<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo apt install unzip wget -y<br><\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2. \u51c6\u5907 Nextcloud \u7684\u6587\u4ef6<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">\u4e0b\u8f7d Nextcloud<\/h4>\n\n\n\n<p>\u8fdb\u5165 Apache \u7684 Web \u6839\u76ee\u5f55\u5e76\u4e0b\u8f7d Nextcloud\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/var\/www\/html\nsudo wget https:\/\/download.nextcloud.com\/server\/releases\/nextcloud-30.0.4.zip<\/code><\/pre>\n\n\n\n<p>\uff08\u66ff\u6362 <code>26.0.5<\/code> \u4e3a\u4f60\u9700\u8981\u7684\u7248\u672c\u53f7\uff0c\u53ef\u4ece <a>Nextcloud \u4e0b\u8f7d\u9875\u9762<\/a> \u67e5\u770b\u6700\u65b0\u7248\u672c\u3002\uff09<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u89e3\u538b\u6587\u4ef6<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo unzip nextcloud-30.0.4.zip<br>sudo rm nextcloud-30.0.4.zip<br><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u8bbe\u7f6e\u6743\u9650<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo chown -R www-data:www-data \/var\/www\/html\/nextcloud<br>sudo chmod -R 755 \/var\/www\/html\/nextcloud<br><\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. \u914d\u7f6e\u6570\u636e\u5e93<\/strong><\/h3>\n\n\n\n<p>\u4e3a Nextcloud \u521b\u5efa\u4e00\u4e2a\u72ec\u7acb\u7684\u6570\u636e\u5e93\u548c\u7528\u6237\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo mysql -u root -p<br><\/code><\/pre>\n\n\n\n<p>\u5728 MySQL \u63a7\u5236\u53f0\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>CREATE DATABASE nextcloud DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;<br>CREATE USER 'nc_user'@'localhost' IDENTIFIED BY 'your_password';<br>GRANT ALL PRIVILEGES ON nextcloud.* TO 'nc_user'@'localhost';<br>FLUSH PRIVILEGES;<br>EXIT;<br><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5c06 <code>your_password<\/code> \u66ff\u6362\u4e3a\u5b89\u5168\u5bc6\u7801\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4. \u914d\u7f6e Apache \u865a\u62df\u4e3b\u673a<\/strong><\/h3>\n\n\n\n<p>\u4e3a Nextcloud \u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u865a\u62df\u4e3b\u673a\u6587\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo vim \/etc\/apache2\/sites-available\/nextcloud.conf<br><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u914d\u7f6e\u793a\u4f8b\uff1a<\/h4>\n\n\n\n<p>\u5982\u679c\u4f60\u6709\u57df\u540d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>&lt;VirtualHost *:80&gt;<br>    ServerName nextcloud.example.com<br>    DocumentRoot \/var\/www\/html\/nextcloud<br>    &lt;Directory \/var\/www\/html\/nextcloud&gt;<br>        Require all granted<br>        AllowOverride All<br>        Options FollowSymLinks MultiViews<br>    &lt;\/Directory&gt;<br>    ErrorLog ${APACHE_LOG_DIR}\/nextcloud_error.log<br>    CustomLog ${APACHE_LOG_DIR}\/nextcloud_access.log combined<br>&lt;\/VirtualHost&gt;<br><\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u6ca1\u6709\u57df\u540d\uff08\u4ec5\u4f7f\u7528 IP \u6216\u4e0d\u540c\u7aef\u53e3\uff09\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>&lt;VirtualHost *:8080&gt;<br>    DocumentRoot \/var\/www\/html\/nextcloud<br>    &lt;Directory \/var\/www\/html\/nextcloud&gt;<br>        Require all granted<br>        AllowOverride All<br>        Options FollowSymLinks MultiViews<br>    &lt;\/Directory&gt;<br>    ErrorLog ${APACHE_LOG_DIR}\/nextcloud_error.log<br>    CustomLog ${APACHE_LOG_DIR}\/nextcloud_access.log combined<br>&lt;\/VirtualHost&gt;<br><\/code><\/pre>\n\n\n\n<p>\u4fdd\u5b58\u540e\u542f\u7528\u865a\u62df\u4e3b\u673a\u5e76\u91cd\u542f Apache\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo a2ensite nextcloud<br>sudo systemctl restart apache2<br><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u542f\u7528\u5fc5\u8981\u6a21\u5757\uff1a<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo a2enmod rewrite headers env dir mime<br>sudo systemctl restart apache2<br><\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>5. \u914d\u7f6e HTTPS\uff08\u53ef\u9009\u4f46\u63a8\u8350\uff09<\/strong><\/h3>\n\n\n\n<p>\u4e3a Nextcloud \u542f\u7528 HTTPS\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo certbot --apache<br><\/code><\/pre>\n\n\n\n<p>\u6309\u7167\u63d0\u793a\u9009\u62e9\u57df\u540d\u5e76\u81ea\u52a8\u914d\u7f6e SSL\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>6. \u8bbf\u95ee Nextcloud \u5e76\u5b8c\u6210\u5b89\u88c5<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u8bbf\u95ee\u6d4f\u89c8\u5668\uff1a\n<ul class=\"wp-block-list\">\n<li>\u5982\u679c\u4f7f\u7528\u57df\u540d\uff1a<code>http:\/\/nextcloud.example.com<\/code><\/li>\n\n\n\n<li>\u5982\u679c\u4f7f\u7528 IP \u548c\u7aef\u53e3\uff1a<code>http:\/\/your-server-ip:8080<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u5728\u5b89\u88c5\u754c\u9762\u5b8c\u6210\u4ee5\u4e0b\u914d\u7f6e\uff1a\n<ul class=\"wp-block-list\">\n<li>\u521b\u5efa\u7ba1\u7406\u5458\u8d26\u6237\u3002<\/li>\n\n\n\n<li>\u586b\u5199\u6570\u636e\u5e93\u4fe1\u606f\uff1a\n<ul class=\"wp-block-list\">\n<li>\u6570\u636e\u5e93\u540d\uff1a<code>nextcloud<\/code><\/li>\n\n\n\n<li>\u7528\u6237\u540d\uff1a<code>nc_user<\/code><\/li>\n\n\n\n<li>\u5bc6\u7801\uff1a\u4f60\u8bbe\u7f6e\u7684 <code>your_password<\/code><\/li>\n\n\n\n<li>\u6570\u636e\u5e93\u4e3b\u673a\uff1a<code>localhost<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u6309\u63d0\u793a\u5b8c\u6210\u5b89\u88c5\u3002<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>7. \u8c03\u4f18\u914d\u7f6e\uff08\u53ef\u9009\uff09<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">\u914d\u7f6e <code>.htaccess<\/code><\/h4>\n\n\n\n<p>\u786e\u4fdd Nextcloud \u80fd\u4f7f\u7528\u4f2a\u9759\u6001 URL\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo -u www-data php \/var\/www\/html\/nextcloud\/occ maintenance:update:htaccess<br><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u542f\u7528\u5185\u5b58\u7f13\u5b58\uff08\u63d0\u5347\u6027\u80fd\uff09<\/h4>\n\n\n\n<p>\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo nano \/var\/www\/html\/nextcloud\/config\/config.php<br><\/code><\/pre>\n\n\n\n<p>\u5728 <code>);<\/code> \u524d\u6dfb\u52a0\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>'memcache.local' =&gt; '\\OC\\Memcache\\APCu',<br><\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>8. \u786e\u4fdd\u9632\u706b\u5899\u8bbe\u7f6e\u6b63\u786e<\/strong><\/h3>\n\n\n\n<p>\u5982\u679c\u4f7f\u7528\u4e86\u81ea\u5b9a\u4e49\u7aef\u53e3\uff08\u5982 8080\uff09\uff0c\u786e\u4fdd\u5b83\u5df2\u88ab\u9632\u706b\u5899\u5141\u8bb8\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo ufw allow 8080<br><\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u5b8c\u6210\u540e\uff0c\u4f60\u7684 WordPress \u548c Nextcloud \u53ef\u4ee5\u5728\u540c\u4e00\u670d\u52a1\u5668\u4e0a\u6b63\u5e38\u8fd0\u884c\u3002\u5982\u679c\u6709\u8fdb\u4e00\u6b65\u95ee\u9898\uff0c\u53ef\u4ee5\u968f\u65f6\u95ee\u6211\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u7ae0\u662f\u5728\u7d27\u968f\u7740\u4e0a\u4e00\u7bc7\u6587\u7ae0https:\/\/www.zhzxs.site\/index.php\/2024\/11\/2 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":108,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[63,64],"class_list":["post-237","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-2","tag-nextcloud","tag-64"],"_links":{"self":[{"href":"https:\/\/www.zhzxs.site\/index.php\/wp-json\/wp\/v2\/posts\/237","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhzxs.site\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhzxs.site\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhzxs.site\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhzxs.site\/index.php\/wp-json\/wp\/v2\/comments?post=237"}],"version-history":[{"count":7,"href":"https:\/\/www.zhzxs.site\/index.php\/wp-json\/wp\/v2\/posts\/237\/revisions"}],"predecessor-version":[{"id":524,"href":"https:\/\/www.zhzxs.site\/index.php\/wp-json\/wp\/v2\/posts\/237\/revisions\/524"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.zhzxs.site\/index.php\/wp-json\/wp\/v2\/media\/108"}],"wp:attachment":[{"href":"https:\/\/www.zhzxs.site\/index.php\/wp-json\/wp\/v2\/media?parent=237"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhzxs.site\/index.php\/wp-json\/wp\/v2\/categories?post=237"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhzxs.site\/index.php\/wp-json\/wp\/v2\/tags?post=237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}