{"id":43204,"date":"2024-10-04T21:11:47","date_gmt":"2024-10-04T13:11:47","guid":{"rendered":"https:\/\/server.hk\/cnblog\/43204\/"},"modified":"2024-10-04T21:11:47","modified_gmt":"2024-10-04T13:11:47","slug":"centos-7-%e4%bd%bf%e7%94%a8-nginxmariadbphp-%e5%ae%89%e8%a3%9d-nextcloud-13","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/43204\/","title":{"rendered":"CentOS 7 \u4f7f\u7528 Nginx+MariaDB+PHP \u5b89\u88dd Nextcloud 13"},"content":{"rendered":"<h1 id=\"centos-7-%e4%bd%bf%e7%94%a8-nginxmariadbphp-%e5%ae%89%e8%a3%9d-nextcloud-13-ijeCauAXLa\">CentOS 7 \u4f7f\u7528 Nginx+MariaDB+PHP \u5b89\u88dd Nextcloud 13<\/h1>\n<p>Nextcloud \u662f\u4e00\u500b\u958b\u6e90\u7684\u96f2\u7aef\u5132\u5b58\u89e3\u6c7a\u65b9\u6848\uff0c\u5141\u8a31\u7528\u6236\u5728\u81ea\u5df1\u7684\u4f3a\u670d\u5668\u4e0a\u5efa\u7acb\u79c1\u6709\u96f2\u3002\u9019\u7bc7\u6587\u7ae0\u5c07\u6307\u5c0e\u60a8\u5982\u4f55\u5728 CentOS 7 \u4e0a\u4f7f\u7528 Nginx\u3001MariaDB \u548c PHP \u5b89\u88dd Nextcloud 13\u3002<\/p>\n<h2 id=\"%e5%89%8d%e7%bd%ae%e6%a2%9d%e4%bb%b6-ijeCauAXLa\">\u524d\u7f6e\u689d\u4ef6<\/h2>\n<ul>\n<li>\u4e00\u53f0\u904b\u884c CentOS 7 \u7684\u4f3a\u670d\u5668\u3002<\/li>\n<li>\u64c1\u6709 root \u6b0a\u9650\u7684\u7528\u6236\u3002<\/li>\n<li>\u5df2\u5b89\u88dd Nginx\u3001MariaDB \u548c PHP\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%ae%89%e8%a3%9d-nginx-ijeCauAXLa\">\u5b89\u88dd Nginx<\/h2>\n<p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u5b89\u88dd Nginx\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9032\u884c\u5b89\u88dd\uff1a<\/p>\n<pre><code>sudo yum install epel-release\nsudo yum install nginx<\/code><\/pre>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u555f\u52d5 Nginx \u4e26\u8a2d\u7f6e\u5176\u5728\u958b\u6a5f\u6642\u81ea\u52d5\u555f\u52d5\uff1a<\/p>\n<pre><code>sudo systemctl start nginx\nsudo systemctl enable nginx<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d-mariadb-ijeCauAXLa\">\u5b89\u88dd MariaDB<\/h2>\n<p>\u63a5\u4e0b\u4f86\uff0c\u5b89\u88dd MariaDB\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>sudo yum install mariadb-server mariadb<\/code><\/pre>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u555f\u52d5 MariaDB \u4e26\u8a2d\u7f6e\u5176\u5728\u958b\u6a5f\u6642\u81ea\u52d5\u555f\u52d5\uff1a<\/p>\n<pre><code>sudo systemctl start mariadb\nsudo systemctl enable mariadb<\/code><\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u57f7\u884c\u5b89\u5168\u6027\u8173\u672c\u4ee5\u52a0\u5f37 MariaDB \u7684\u5b89\u5168\u6027\uff1a<\/p>\n<pre><code>sudo mysql_secure_installation<\/code><\/pre>\n<p>\u6839\u64da\u63d0\u793a\u8a2d\u7f6e root \u5bc6\u78bc\uff0c\u4e26\u9078\u64c7\u5176\u4ed6\u5b89\u5168\u9078\u9805\u3002<\/p>\n<h2 id=\"%e5%89%b5%e5%bb%ba-nextcloud-%e6%95%b8%e6%93%9a%e5%ba%ab-ijeCauAXLa\">\u5275\u5efa Nextcloud \u6578\u64da\u5eab<\/h2>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u767b\u9304 MariaDB\uff1a<\/p>\n<pre><code>sudo mysql -u root -p<\/code><\/pre>\n<p>\u7136\u5f8c\u5275\u5efa\u4e00\u500b\u6578\u64da\u5eab\u548c\u7528\u6236\uff0c\u4e26\u6388\u4e88\u8a72\u7528\u6236\u5c0d\u6578\u64da\u5eab\u7684\u6240\u6709\u6b0a\u9650\uff1a<\/p>\n<pre><code>CREATE DATABASE nextcloud;\nCREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'your_password';\nGRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';\nFLUSH PRIVILEGES;\nEXIT;<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d-php-ijeCauAXLa\">\u5b89\u88dd PHP<\/h2>\n<p>\u63a5\u4e0b\u4f86\uff0c\u5b89\u88dd PHP \u53ca\u5176\u6240\u9700\u7684\u64f4\u5c55\uff1a<\/p>\n<pre><code>sudo yum install php php-fpm php-mysql php-xml php-mbstring php-curl php-zip<\/code><\/pre>\n<p>\u555f\u52d5 PHP-FPM \u4e26\u8a2d\u7f6e\u5176\u5728\u958b\u6a5f\u6642\u81ea\u52d5\u555f\u52d5\uff1a<\/p>\n<pre><code>sudo systemctl start php-fpm\nsudo systemctl enable php-fpm<\/code><\/pre>\n<h2 id=\"%e9%85%8d%e7%bd%ae-nginx-ijeCauAXLa\">\u914d\u7f6e Nginx<\/h2>\n<p>\u63a5\u4e0b\u4f86\uff0c\u60a8\u9700\u8981\u914d\u7f6e Nginx \u4ee5\u652f\u6301 Nextcloud\u3002\u5275\u5efa\u4e00\u500b\u65b0\u7684 Nginx \u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<pre><code>sudo vi \/etc\/nginx\/conf.d\/nextcloud.conf<\/code><\/pre>\n<p>\u5728\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5167\u5bb9\uff1a<\/p>\n<pre><code>server {\n    listen 80;\n    server_name your_domain.com; # \u66ff\u63db\u70ba\u60a8\u7684\u57df\u540d\n\n    root \/var\/www\/nextcloud;\n    index index.php index.html index.htm;\n\n    location \/ {\n        rewrite ^ \/index.php$request_uri;\n    }\n\n    location ~ .php$ {\n        include fastcgi_params;\n        fastcgi_pass 127.0.0.1:9000;\n        fastcgi_index index.php;\n        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n    }\n\n    location ~ \/.ht {\n        deny all;\n    }\n}<\/code><\/pre>\n<p>\u4fdd\u5b58\u4e26\u9000\u51fa\u7de8\u8f2f\u5668\uff0c\u7136\u5f8c\u6aa2\u67e5 Nginx \u914d\u7f6e\u662f\u5426\u6b63\u78ba\uff1a<\/p>\n<pre><code>sudo nginx -t<\/code><\/pre>\n<p>\u5982\u679c\u6c92\u6709\u932f\u8aa4\uff0c\u91cd\u65b0\u555f\u52d5 Nginx\uff1a<\/p>\n<pre><code>sudo systemctl restart nginx<\/code><\/pre>\n<h2 id=\"%e4%b8%8b%e8%bc%89-nextcloud-ijeCauAXLa\">\u4e0b\u8f09 Nextcloud<\/h2>\n<p>\u63a5\u4e0b\u4f86\uff0c\u4e0b\u8f09 Nextcloud \u7684\u6700\u65b0\u7248\u672c\uff1a<\/p>\n<pre><code>wget https:\/\/download.nextcloud.com\/server\/releases\/nextcloud-13.0.0.zip\nunzip nextcloud-13.0.0.zip\nsudo mv nextcloud \/var\/www\/<\/code><\/pre>\n<p>\u8a2d\u7f6e\u9069\u7576\u7684\u6b0a\u9650\uff1a<\/p>\n<pre><code>sudo chown -R nginx:nginx \/var\/www\/nextcloud\nsudo chmod -R 755 \/var\/www\/nextcloud<\/code><\/pre>\n<h2 id=\"%e5%ae%8c%e6%88%90%e5%ae%89%e8%a3%9d-ijeCauAXLa\">\u5b8c\u6210\u5b89\u88dd<\/h2>\n<p>\u73fe\u5728\uff0c\u60a8\u53ef\u4ee5\u901a\u904e\u700f\u89bd\u5668\u8a2a\u554f\u60a8\u7684 Nextcloud \u5be6\u4f8b\u3002\u6253\u958b\u700f\u89bd\u5668\u4e26\u8f38\u5165\u60a8\u7684\u57df\u540d\u6216\u4f3a\u670d\u5668 IP \u5730\u5740\uff0c\u7136\u5f8c\u6309\u7167\u5c4f\u5e55\u4e0a\u7684\u6307\u793a\u5b8c\u6210\u5b89\u88dd\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-ijeCauAXLa\">\u7e3d\u7d50<\/h2>\n<p>\u5728\u9019\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u5011\u4ecb\u7d39\u4e86\u5982\u4f55\u5728 CentOS 7 \u4e0a\u4f7f\u7528 Nginx\u3001MariaDB \u548c PHP \u5b89\u88dd Nextcloud 13\u3002\u9019\u500b\u904e\u7a0b\u6d89\u53ca\u5230\u5b89\u88dd\u5fc5\u8981\u7684\u8edf\u4ef6\u3001\u914d\u7f6e\u4f3a\u670d\u5668\u4ee5\u53ca\u8a2d\u7f6e\u6578\u64da\u5eab\u3002\u82e5\u60a8\u9700\u8981\u7a69\u5b9a\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u4f86\u904b\u884c\u60a8\u7684 Nextcloud\uff0c\u8acb\u8003\u616e\u6211\u5011\u7684\u670d\u52d9\uff0c\u63d0\u4f9b\u9ad8\u6548\u80fd\u7684 <a href=\"https:\/\/server.hk\">\u4f3a\u670d\u5668<\/a> \u89e3\u6c7a\u65b9\u6848\uff0c\u6eff\u8db3\u60a8\u7684\u9700\u6c42\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to install Nextcloud 13 on CentOS 7 using Nginx, MariaDB, and PHP for a powerful self-hosted cloud solution.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-43204","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43204","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=43204"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43204\/revisions"}],"predecessor-version":[{"id":43205,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43204\/revisions\/43205"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=43204"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=43204"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=43204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}