{"id":43706,"date":"2024-10-06T04:17:49","date_gmt":"2024-10-05T20:17:49","guid":{"rendered":"https:\/\/server.hk\/cnblog\/43706\/"},"modified":"2024-10-06T04:17:49","modified_gmt":"2024-10-05T20:17:49","slug":"centos-7-2-%e6%90%ad%e5%bb%ba-owncloud-%e7%a7%81%e6%9c%89%e9%9b%b2%e4%b8%a6%e5%95%9f%e7%94%a8-ssl","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/43706\/","title":{"rendered":"CentOS 7.2 \u642d\u5efa ownCloud \u79c1\u6709\u96f2\u4e26\u555f\u7528 SSL"},"content":{"rendered":"<h1 id=\"centos-7-2-%e6%90%ad%e5%bb%ba-owncloud-%e7%a7%81%e6%9c%89%e9%9b%b2%e4%b8%a6%e5%95%9f%e7%94%a8-ssl-aGsHxWOflF\">CentOS 7.2 \u642d\u5efa ownCloud \u79c1\u6709\u96f2\u4e26\u555f\u7528 SSL<\/h1>\n<p>\u5728\u7576\u4eca\u6578\u4f4d\u5316\u7684\u6642\u4ee3\uff0c\u79c1\u6709\u96f2\u5b58\u5132\u89e3\u6c7a\u65b9\u6848\u8d8a\u4f86\u8d8a\u53d7\u5230\u91cd\u8996\u3002ownCloud \u662f\u4e00\u500b\u958b\u6e90\u7684\u96f2\u5b58\u5132\u5e73\u53f0\uff0c\u5141\u8a31\u7528\u6236\u5728\u81ea\u5df1\u7684\u4f3a\u670d\u5668\u4e0a\u642d\u5efa\u79c1\u6709\u96f2\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 CentOS 7.2 \u4e0a\u642d\u5efa ownCloud \u4e26\u555f\u7528 SSL\uff0c\u4ee5\u78ba\u4fdd\u6578\u64da\u7684\u5b89\u5168\u6027\u3002<\/p>\n<h2 id=\"%e5%89%8d%e6%9c%9f%e6%ba%96%e5%82%99-aGsHxWOflF\">\u524d\u671f\u6e96\u5099<\/h2>\n<p>\u5728\u958b\u59cb\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u78ba\u4fdd\u60a8\u7684 CentOS 7.2 \u7cfb\u7d71\u5df2\u7d93\u66f4\u65b0\u5230\u6700\u65b0\u7248\u672c\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9032\u884c\u66f4\u65b0\uff1a<\/p>\n<pre><code>sudo yum update -y<\/code><\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u60a8\u9700\u8981\u5b89\u88dd\u4e00\u4e9b\u5fc5\u8981\u7684\u8edf\u4ef6\u5305\uff0c\u5305\u62ec Apache\u3001MariaDB \u548c PHP\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9032\u884c\u5b89\u88dd\uff1a<\/p>\n<pre><code>sudo yum install httpd mariadb-server php php-mysql php-xml php-mbstring php-curl -y<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d-owncloud-aGsHxWOflF\">\u5b89\u88dd ownCloud<\/h2>\n<p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u4e0b\u8f09 ownCloud \u7684\u6700\u65b0\u7248\u672c\u3002\u53ef\u4ee5\u8a2a\u554f <a href=\"https:\/\/owncloud.org\/download\/\" target=\"_blank\" rel=\"nofollow noopener\">ownCloud \u5b98\u65b9\u7db2\u7ad9<\/a> \u4ee5\u7372\u53d6\u6700\u65b0\u7684\u4e0b\u8f09\u93c8\u63a5\u3002\u4f7f\u7528 wget \u547d\u4ee4\u4e0b\u8f09\uff1a<\/p>\n<pre><code>wget https:\/\/download.owncloud.org\/community\/owncloud-x.y.z.zip<\/code><\/pre>\n<p>\u8acb\u5c07 &#8220;x.y.z&#8221; \u66ff\u63db\u70ba\u6700\u65b0\u7248\u672c\u865f\u3002\u4e0b\u8f09\u5b8c\u6210\u5f8c\uff0c\u89e3\u58d3\u7e2e\u6587\u4ef6\u4e26\u5c07\u5176\u79fb\u52d5\u5230 Apache \u7684\u6839\u76ee\u9304\uff1a<\/p>\n<pre><code>unzip owncloud-x.y.z.zip\nsudo mv owncloud \/var\/www\/html\/<\/code><\/pre>\n<h2 id=\"%e9%85%8d%e7%bd%ae-apache-aGsHxWOflF\">\u914d\u7f6e Apache<\/h2>\n<p>\u63a5\u4e0b\u4f86\uff0c\u60a8\u9700\u8981\u914d\u7f6e Apache \u4ee5\u652f\u6301 ownCloud\u3002\u7de8\u8f2f Apache \u7684\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<pre><code>sudo vi \/etc\/httpd\/conf.d\/owncloud.conf<\/code><\/pre>\n<p>\u5728\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5167\u5bb9\uff1a<\/p>\n<pre><code>&lt;Directory \/var\/www\/html\/owncloud&gt;\n    Options Indexes FollowSymLinks\n    AllowOverride All\n    Require all granted\n&lt;\/Directory&gt;\n\n&lt;IfModule mod_dav.c&gt;\n    Dav off\n&lt;\/IfModule&gt;<\/code><\/pre>\n<p>\u4fdd\u5b58\u4e26\u9000\u51fa\u7de8\u8f2f\u5668\uff0c\u7136\u5f8c\u555f\u7528 Apache \u6a21\u7d44\u4e26\u91cd\u555f\u670d\u52d9\uff1a<\/p>\n<pre><code>sudo systemctl restart httpd<\/code><\/pre>\n<h2 id=\"%e8%a8%ad%e7%bd%ae-mariadb-%e6%95%b8%e6%93%9a%e5%ba%ab-aGsHxWOflF\">\u8a2d\u7f6e MariaDB \u6578\u64da\u5eab<\/h2>\n<p>\u63a5\u4e0b\u4f86\uff0c\u60a8\u9700\u8981\u8a2d\u7f6e MariaDB \u6578\u64da\u5eab\u4ee5\u652f\u6301 ownCloud\u3002\u9996\u5148\u555f\u52d5 MariaDB \u670d\u52d9\uff1a<\/p>\n<pre><code>sudo systemctl start mariadb\nsudo mysql_secure_installation<\/code><\/pre>\n<p>\u6309\u7167\u63d0\u793a\u8a2d\u7f6e root \u5bc6\u78bc\u4e26\u9032\u884c\u5176\u4ed6\u5b89\u5168\u8a2d\u7f6e\u3002\u7136\u5f8c\u767b\u9304 MariaDB \u4e26\u5275\u5efa ownCloud \u6578\u64da\u5eab\uff1a<\/p>\n<pre><code>sudo mysql -u root -p\nCREATE DATABASE owncloud;\nCREATE USER 'ownclouduser'@'localhost' IDENTIFIED BY 'password';\nGRANT ALL PRIVILEGES ON owncloud.* TO 'ownclouduser'@'localhost';\nFLUSH PRIVILEGES;\nEXIT;<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d-ssl-%e8%ad%89%e6%9b%b8-aGsHxWOflF\">\u5b89\u88dd SSL \u8b49\u66f8<\/h2>\n<p>\u70ba\u4e86\u4fdd\u8b77\u60a8\u7684\u6578\u64da\uff0c\u5efa\u8b70\u555f\u7528 SSL\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528 Let&#8217;s Encrypt \u514d\u8cbb\u7372\u53d6 SSL \u8b49\u66f8\u3002\u9996\u5148\uff0c\u5b89\u88dd Certbot\uff1a<\/p>\n<pre><code>sudo yum install epel-release -y\nsudo yum install certbot python2-certbot-apache -y<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u4f7f\u7528 Certbot \u7372\u53d6 SSL \u8b49\u66f8\uff1a<\/p>\n<pre><code>sudo certbot --apache -d yourdomain.com<\/code><\/pre>\n<p>\u8acb\u5c07 &#8220;yourdomain.com&#8221; \u66ff\u63db\u70ba\u60a8\u7684\u57df\u540d\u3002\u6309\u7167\u63d0\u793a\u5b8c\u6210\u8b49\u66f8\u7684\u5b89\u88dd\u3002<\/p>\n<h2 id=\"%e5%ae%8c%e6%88%90%e5%ae%89%e8%a3%9d-aGsHxWOflF\">\u5b8c\u6210\u5b89\u88dd<\/h2>\n<p>\u73fe\u5728\uff0c\u60a8\u53ef\u4ee5\u901a\u904e\u700f\u89bd\u5668\u8a2a\u554f\u60a8\u7684 ownCloud \u5be6\u4f8b\uff0c\u4e26\u4f7f\u7528\u525b\u624d\u5275\u5efa\u7684\u6578\u64da\u5eab\u7528\u6236\u540d\u548c\u5bc6\u78bc\u9032\u884c\u767b\u9304\u3002\u8a2a\u554f\u5730\u5740\u70ba <a href=\"https:\/\/yourdomain.com\/owncloud\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/yourdomain.com\/owncloud<\/a>\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-aGsHxWOflF\">\u7e3d\u7d50<\/h2>\n<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5011\u4ecb\u7d39\u4e86\u5982\u4f55\u5728 CentOS 7.2 \u4e0a\u642d\u5efa ownCloud \u79c1\u6709\u96f2\u4e26\u555f\u7528 SSL\u3002\u9019\u6a23\u4e0d\u50c5\u80fd\u5920\u4fdd\u8b77\u60a8\u7684\u6578\u64da\uff0c\u9084\u80fd\u63d0\u4f9b\u9748\u6d3b\u7684\u96f2\u5b58\u5132\u89e3\u6c7a\u65b9\u6848\u3002\u5982\u679c\u60a8\u9700\u8981\u7a69\u5b9a\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u670d\u52d9\u4f86\u904b\u884c\u60a8\u7684 ownCloud\uff0c\u8acb\u8003\u616e\u4f7f\u7528\u6211\u5011\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2f\u4f3a\u670d\u5668<\/a> \u89e3\u6c7a\u65b9\u6848\uff0c\u70ba\u60a8\u7684\u79c1\u6709\u96f2\u63d0\u4f9b\u5f37\u5927\u7684\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to set up ownCloud on CentOS 7.2 and enable SSL for secure private cloud storage in this step-by-step guide.<\/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-43706","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43706","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=43706"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43706\/revisions"}],"predecessor-version":[{"id":43707,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43706\/revisions\/43707"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=43706"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=43706"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=43706"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}