{"id":1866,"date":"2012-12-21T18:58:12","date_gmt":"2012-12-21T10:58:12","guid":{"rendered":"http:\/\/www.zuola.com\/weblog\/?p=1866"},"modified":"2012-12-21T20:31:21","modified_gmt":"2012-12-21T12:31:21","slug":"%e5%ad%a6%e4%b9%a0amazon%e7%9a%84ec2%e4%b8%bb%e6%9c%ba%e7%9a%84%e7%ac%94%e8%ae%b0","status":"publish","type":"post","link":"https:\/\/www.zuola.com\/weblog\/2012\/12\/1866.htm","title":{"rendered":"\u5b66\u4e60amazon\u7684ec2\u4e3b\u673a\u7684\u7b14\u8bb0"},"content":{"rendered":"<p><a href=\"http:\/\/aws.amazon.com\/cn\/\">http:\/\/aws.amazon.com\/cn<\/a>\/ \u7684\u4e91\u670d\u52a1\u5f00\u59cb\u5c1d\u8bd5\u63d0\u4f9b\u4e2d\u6587\u754c\u9762\u4e86\uff0c\u4f46\u5f88\u591a\u8d44\u6599\u8fd8\u662f\u82f1\u6587\uff0c\u5bf9\u6211\u4ecd\u7136\u6709\u70b9\u8d39\u529b\uff0c\u4e0d\u8fc7\u6211\u8fd8\u662f\u82b1\u4e86\u4e9b\u65f6\u95f4\u5c1d\u8bd5\u7406\u89e3\u4e9a\u9a6c\u900a\u7684\u4e91\u670d\u52a1\uff0c\u6ca1\u7406\u89e3\u4e9a\u9a6c\u900a\u7684\u4e91\u670d\u52a1\u7684\u540d\u8bcd\u548c\u903b\u8f91\u4e4b\u524d\u5b8c\u5168\u662f\u4e00\u5934\u96fe\u6c34\u3002\u6211\u8bf4\u8bf4\u6211\u7684\u7406\u89e3\u5427\uff0c\u6211\u53ea\u77e5\u9053s3\u662f\u5b58\u50a8\u670d\u52a1\uff0cec2\u662f\u63d0\u4f9b\u4e00\u53f0\u865a\u62df\u4e3b\u673a(VPS)\uff0c\u865a\u62df\u4e3b\u673a\u4e0a\u53ef\u8fd0\u884c\u64cd\u4f5c\u7cfb\u7edf\uff0c\u64cd\u4f5c\u7cfb\u7edf\u53ef\u4ee5\u9009linux\u3001windows\uff0c\u5e76\u4e14linux\u8fd8\u6709\u5404\u79cd\u7248\u672c\u63d0\u4f9b\uff0c\u53ea\u9700\u8981\u9009AMI\u5c31\u597d\u4e86\uff0cAMI (amazon machine image)\u5c31\u662f\u7c7b\u4f3cghost\u7684\u955c\u50cf\u6587\u4ef6\u4e00\u6837\u7684\u4e1c\u4e1c\uff0c\u5b89\u88c5\u597d\u64cd\u4f5c\u7cfb\u7edf\u540e\u91cc\u5c31\u9884\u5148\u8bbe\u7f6e\u597d\u4e00\u4e9b\u8f6f\u4ef6\u4e86\uff0c\u6bd4\u5982\u6211\u9009\u4e86\u4e00\u4e2awordpress\u7684AMI\uff0c\u5b89\u88c5\u5c31\u80fd\u7528\u3002\u6709\u4e9bAMI\u662f\u9700\u8981\u4ed8\u8d39\uff0c\u5e94\u8be5\u662f\u4e70\u64cd\u4f5c\u7cfb\u7edf\u7684\u6388\u6743\u8d39\u3002\u6211\u7528\u7684ubuntu\u5c31\u662f\u514d\u8d39\u7684\u3002\u4f30\u8ba1\u7528\u522b\u4eba\u9884\u5148\u8bbe\u7f6e\u597d\u7684AMI\u4e5f\u662f\u8981\u82b1\u94b1\u7684\u3002\u5728\u9009AMI\u4e4b\u524d\u597d\u50cf\u8fd8\u53ef\u4ee5\u9009\u673a\u623f\uff0c\u6709\u7f8e\u56fd\u673a\u623f\u548c\u65b0\u52a0\u5761\u673a\u623f\uff0c\u6bcf\u4e2a\u533a\u57df\u7684\u4ef7\u683c\u8fd8\u4e0d\u4e00\u6837\u3002<\/p>\n<p><a href=\"http:\/\/aws.amazon.com\/cn\/ec2\/#instance\">\u5b9e\u4f8b(instance)<\/a>\u5bf9\u6211\u6765\u8bf4\u662f\u4e00\u4e2a\u65b0\u540d\u8bcd\uff0c\u6362\u6210\u201c\u4e3b\u673a\u201d\u5c31\u597d\u7406\u89e3\u4e86\uff0c\u6bcf\u4e2a\u201c\u4e3b\u673a\u201d\u90fd\u8981\u82b1\u94b1\uff0c\u901a\u5e38\u6807\u6ce8\u7684\u4ef7\u683c\u662f\u6bcf\u5c0f\u65f6\u7684\u4ef7\u683c\uff0c\u5982\u4e00\u53f0\u00a00.020\u7684\u4e3b\u673a\u662f\u6307\u6bcf\u5c0f\u65f6\u6536\u8d390.020\u7f8e\u5143\uff0c\u5176\u5b9e\u4e0d\u4fbf\u5b9c\uff0c\u6362\u7b97\u6210\u6708\u79df\u662f\u00a00.020\u00d724\u00d730\uff0c\u662f14.4\u7f8e\u5143\u4e00\u4e2a\u6708\u3002\u8fd8\u597d\u65b0\u7528\u6237\u7ed1\u5b9a\u4fe1\u7528\u5361\u53ef\u4ee5\u514d\u8d39\u4f7f\u7528t1.micro \u7684\u4e3b\u673a\u4e00\u5e74\u3002\u5148\u62ff\u6765\u5b66\u4e60\u5b66\u4e60\u4e5f\u4e0d\u9519\u3002\u4e0a\u6b21\u6211<a href=\"http:\/\/help.adobe.com\/en_US\/flashmediaserver\/amazonec2\/index.html\">\u4f53\u9a8cAdobe\u5728amazon\u7684Flash\u6d41\u5a92\u4f53\u670d\u52a1\u5668<\/a>\u65f6\uff0c\u4e0d\u77e5\u9053\u79df\u4e2alarge\u8d85\u8d35\u7684\uff0c\u4e5f\u4e0d\u77e5\u9053\u5173\u673a\uff0c\u7ed3\u679c\u4e00\u4e2a\u6708\u4e0b\u6765\u4e09\u767e\u591a\u7f8e\u5143\uff0c\u8fd8\u597d\u5411\u5ba2\u670d\u9648\u60c5\u514d\u5355\u4e86\u3002\u5f3a\u70c8\u5efa\u8baeamazon\u65b0\u624b\u6ce8\u610f\u4fe1\u7528\u5361\u5b89\u5168\uff0c\u8bb0\u5f97\u8981\u5173\u673a\uff0c\u4e0d\u7136\u4e0d\u7528\u4e5f\u5f97\u82b1\u94b1\u3002<\/p>\n<p>\u597d\u4e86\uff0c\u6211\u5bf9amazon\u7684\u521d\u6b65\u7406\u89e3\u8bf4\u5b8c\u4e86\u3002\u4e0b\u9762\u662f\u6211\u4eca\u5929\u7684\u5b66\u4e60\u7b14\u8bb0\uff0c\u4e5f\u5c3d\u91cf\u7ed9\u522b\u4eba\u505a\u53c2\u8003\uff0c\u514d\u5f97\u50cf\u6211\u4e00\u6837\u8d70\u51a4\u6789\u8def\u589e\u52a0\u5b66\u4e60\u6210\u672c\u3002<\/p>\n<p>\u6ce8\u518camazon\u5e10\u53f7\uff0c\u7ed1\u5b9a\u4fe1\u7528\u5361<\/p>\n<p>\u6ce8\u518cec2\uff0c\u4f7f\u7528t1.micro\u7684\u5b9e\u4f8b\u662f\u7b2c\u4e00\u5e74\u514d\u8d39\u7684\uff0c\u53ea\u5bf9\u65b0\u4fe1\u7528\u5361\u7528\u6237\u514d\u8d39\u4e00\u5e74\u3002<\/p>\n<p>\u767b\u5f55\u00a0<a href=\"https:\/\/console.aws.amazon.com\/ec2\/\">https:\/\/console.aws.amazon.com\/ec2\/<\/a><\/p>\n<p>\u6700\u597d\u5148\u5230 NETWORK &amp; SECURITY \u7684 Key Pairs \u751f\u6210\u4e00\u4e2a\u5bc6\u94a5\u518d\u505a\u5176\u4ed6\u64cd\u4f5c\uff0c\u8fd9\u4e2a\u5bc6\u94a5\u662f\u7528\u6765SSH\u767b\u5f55\u5230amazon\u4e3b\u673a\u7684\u3002<\/p>\n<p><img decoding=\"async\" title=\"\u66f4\u591a...\" alt=\"\" src=\"http:\/\/www.zuola.com\/weblog\/wp-content\/uploads\/2012\/12\/trans.gif\" \/>\u6211\u9009\u4e86\u00a0bitnami-wordpress-3.4.2-0-linux-ubuntu-12.04.2-x86_64-ebs \u8fd9\u4e2aAMI\uff0c\u8fd9\u662f\u6211\u5728\u627eAMI\u65f6\u641c\u7d22wordpress\u627e\u51fa\u6765\u7684\u3002<\/p>\n<p><!--more-->\u5728amazon\u4e0a\u5b89\u88c5wordpress\u9047\u5230\u4e00\u4e9b\u9ebb\u70e6,amazon\u4e0a\u9762\u63d0\u793a\u7684\u7528\u00a0ssh -i zola.pem\u00a0ubuntu@204.236.236.251 \u6765\u767b\u5f55\u662f\u4e0d\u5bf9\u7684\uff0c\u7528\u6237\u540d\u4e0d\u5bf9\uff0c\u4f1a\u63d0\u793a\u00a0Permission denied (publickey)\uff0c\u6211\u5b89\u88c5\u7684AMI \uff08ami-03f6466a\uff09\u6539\u53d8\u9ed8\u8ba4\u7528\u6237\u540d\u4e3a\u00a0bitnami\u4e86<\/p>\n<blockquote><p>zuola:~ zola$ ssh -v -i zola.pem ubuntu@204.236.236.251 (SSH\u7684 -v \u53c2\u6570\u662fdebug\u6a21\u5f0f\uff0c\u663e\u793a\u66f4\u591a\u5185\u5bb9\u4f9b\u6211\u4eec\u67e5\u627e\u95ee\u9898)<br \/>\nOpenSSH_5.9p1, OpenSSL 0.9.8r 8 Feb 2011<br \/>\ndebug1: Reading configuration data \/etc\/ssh_config<br \/>\ndebug1: \/etc\/ssh_config line 20: Applying options for *<br \/>\ndebug1: \/etc\/ssh_config line 53: Applying options for *<br \/>\ndebug1: Connecting to 204.236.236.251 [204.236.236.251] port 22.<br \/>\ndebug1: Connection established.<br \/>\ndebug1: identity file zola.pem type -1<br \/>\ndebug1: identity file zola.pem-cert type -1<br \/>\ndebug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1<br \/>\ndebug1: match: OpenSSH_5.9p1 Debian-5ubuntu1 pat OpenSSH*<br \/>\ndebug1: Enabling compatibility mode for protocol 2.0<br \/>\ndebug1: Local version string SSH-2.0-OpenSSH_5.9<br \/>\ndebug1: SSH2_MSG_KEXINIT sent<br \/>\ndebug1: SSH2_MSG_KEXINIT received<br \/>\ndebug1: kex: server-&gt;client aes128-ctr hmac-md5 none<br \/>\ndebug1: kex: client-&gt;server aes128-ctr hmac-md5 none<br \/>\ndebug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024&lt;1024&lt;8192) sent<br \/>\ndebug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP<br \/>\ndebug1: SSH2_MSG_KEX_DH_GEX_INIT sent<br \/>\ndebug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY<br \/>\ndebug1: Server host key: RSA 60:14:41:cf:86:39:9c:6d:39:62:01:aa:73:ea:8a:7f<br \/>\ndebug1: Host &#8216;204.236.236.251&#8217; is known and matches the RSA host key.<br \/>\ndebug1: Found key in \/Users\/zola\/.ssh\/known_hosts:1<br \/>\ndebug1: ssh_rsa_verify: signature correct<br \/>\ndebug1: SSH2_MSG_NEWKEYS sent<br \/>\ndebug1: expecting SSH2_MSG_NEWKEYS<br \/>\ndebug1: SSH2_MSG_NEWKEYS received<br \/>\ndebug1: Roaming not allowed by server<br \/>\ndebug1: SSH2_MSG_SERVICE_REQUEST sent<br \/>\ndebug1: SSH2_MSG_SERVICE_ACCEPT received<br \/>\ndebug1: Authentications that can continue: publickey<br \/>\ndebug1: Next authentication method: publickey<br \/>\ndebug1: Trying private key: dnp.pem<br \/>\ndebug1: read PEM private key done: type RSA<br \/>\ndebug1: Authentications that can continue: publickey<br \/>\ndebug1: No more authentication methods to try.<br \/>\nPermission denied (publickey).<\/p><\/blockquote>\n<p>\u8fd9\u4e2aPermission denied (publickey) \u00a0\u5c31\u8ba9\u6211\u641c\u7d22\u534a\u5929\uff0c\u539f\u6765\u9ed8\u8ba4\u7528\u6237\u540d\u4e0d\u662fubuntu,\u800c\u662f\u00a0bitnami \u7528\u00a0ssh -v -i zola.pem bitnami@204.236.236.251 \u00a0\u5c31\u767b\u5f55\u6210\u529f\u4e86\uff0c\u4e0d\u68c0\u67e5\u5bc6\u7801\u3002<\/p>\n<p>\u5f00\u59cb\u6211\u8fd8\u9047\u5230\u00a0Permissions 0444 for &#8216;zola.pem&#8217; are too open. \u7684\u95ee\u9898\uff0c\u89e3\u51b3\u529e\u6cd5\u662f\uff1a<\/p>\n<p>chmod 400 zola.pem<\/p>\n<p>\u8fd9\u4e2a\u6b65\u9aa4\u5012\u662famazon\u63d0\u4f9b\u7684\uff0c\u8fd9\u5012\u6ca1\u9519\u3002<\/p>\n<p>\u7136\u540e\u8fd8\u8981\u5230 NETWORK &amp; SECURITY \u4e0b\u7684 Elastic IPs \u4e0b\u9762\u6dfb\u52a0IP\uff0c\u7136\u540e\u7ed1\u5b9a\u5230 t1.micro \u5b9e\u4f8b\u4e0a\uff0c\u636e\u8bf4\u4e0d\u6536\u8d39\u3002<\/p>\n<p>\u5230 NETWORK &amp; SECURITY \u7684 Security Groups \u91cc\u7ed9\u81ea\u5df1\u7684 t1.micro \u5b9e\u4f8b \u6240\u5728\u7ec4\u52a0\u4e00\u4e2atcp 80 \u7684\u9632\u706b\u5899\u89c4\u5219\uff0c\u4e0d\u7136\u8bbf\u95ee\u4e0d\u5230 204.236.236.251 \u7684 80\u7aef\u53e3\u3002<\/p>\n<p>\u8fd9\u6837\uff0c\u5c31\u80fd\u8bbf\u95ee\u5230204.236.236.251\/wordpress\u4e86\uff0c\u4f46\u767b\u5f55wordpress\u540e\u53f0\u8981\u7528user\u4e3a\u7528\u6237\u540d\uff0c\u5bc6\u7801\u662f \u00a0bitnami \u8fd9\u90fd\u662f\u8fd9\u4e2aAMI\u5185\u7f6e\u7684\u3002<\/p>\n<p>\u7531\u4e8e\u9ed8\u8ba4\u7684 wordpress \u662f\u5b89\u88c5\u5728\u00a0204.236.236.251\/wordpress \u8fd9\u4e2a\u76ee\u5f55\u91cc\uff0c<\/p>\n<p>\u6240\u4ee5\u6211\u7167\u4e0b\u9762\u8fd9\u7bc7\u6587\u7ae0\u7684\u65b9\u6cd5\u628awordpress\u4fee\u6539\u5230\u00a0204.236.236.251 \u7684\u6839\u76ee\u5f55\u91cc<\/p>\n<p><a href=\"http:\/\/adamjohnston.me\/2012\/02\/24\/using-wordpress-on-aws-free-3\/\">http:\/\/adamjohnston.me\/2012\/02\/24\/using-wordpress-on-aws-free-3\/<\/a><\/p>\n<p>\u5927\u6982\u6d41\u7a0b\u662f\uff1a<\/p>\n<ol>\n<li>\u00a0\u53bbapache\u7684\u914d\u7f6e\u6587\u4ef6\u91cc\u4fee\u6539\u6587\u6863\u76ee\u5f55\u5230wordpress\u7684\u76ee\u5f55\uff1a<br \/>\nsudo vi \/opt\/bitnami\/apache2\/conf\/httpd.conf \u628a<br \/>\nDocumentRoot \u201c\/opt\/bitnami\/apache2\/htdocs\u201d<br \/>\n\u6539\u4e3a<br \/>\nDocumentRoot \u201c\/opt\/bitnami\/apps\/wordpress\/htdocs\u201d<br \/>\n&lt;Directory \/&gt;<br \/>\nOptions Indexes MultiViews +FollowSymLinks<br \/>\nAllowOverride All<br \/>\nOrder allow,deny<br \/>\nAllow from all<br \/>\n&lt;\/Directory&gt;<\/li>\n<li>\u6ce8\u91ca\u6389#Include \u201c\/opt\/bitnami\/apps\/wordpress\/conf\/wordpress.conf\u201d<\/li>\n<li>\u6dfb\u52a0.htaccess\u6587\u4ef6vi \/opt\/bitnami\/apps\/wordpress\/htdocs\/.htaccess<br \/>\n# BEGIN WordPress<br \/>\n&lt;IfModule mod_rewrite.c&gt;<br \/>\nRewriteEngine On<br \/>\nRewriteBase \/<br \/>\nRewriteCond %{REQUEST_URI} !=\/server-status<br \/>\nRewriteCond %{REQUEST_FILENAME} !-f<br \/>\nRewriteCond %{REQUEST_FILENAME} !-d<br \/>\nRewriteRule . \/index.php [L]<br \/>\n&lt;\/IfModule&gt;<br \/>\n# END WordPress<\/li>\n<li>\u4fee\u6539wp-config.php<br \/>\nsudo vi \/opt\/bitnami\/apps\/wordpress\/htdocs\/wp-config.php<br \/>\ndefine(\u2018WP_HOME\u2019, \u2018http:\/\/amazon.zuola.com\u2019);<br \/>\ndefine(\u2018WP_SITEURL\u2019, \u2018http:\/\/amazon.zuola.com\u2019);<\/li>\n<\/ol>\n<p>\u597d\u4e86\uff0c\u6211\u7684amazon\u7684BLOG\u5728\u8fd9\u91cc\uff0c\u6765\u53c2\u89c2\u5427 <a href=\"http:\/\/amazon.zuola.com\">http:\/\/amazon.zuola.com<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>http:\/\/aws.amazon.com\/cn\/ \u7684\u4e91\u670d\u52a1\u5f00\u59cb\u5c1d\u8bd5\u63d0\u4f9b\u4e2d\u6587\u754c\u9762 <span class=\"readmore\"><a href=\"https:\/\/www.zuola.com\/weblog\/2012\/12\/1866.htm\">Continue Reading &#8230;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1866","post","type-post","status-publish","format-standard","hentry","category-review"],"views":4136,"_links":{"self":[{"href":"https:\/\/www.zuola.com\/weblog\/wp-json\/wp\/v2\/posts\/1866","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zuola.com\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zuola.com\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zuola.com\/weblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zuola.com\/weblog\/wp-json\/wp\/v2\/comments?post=1866"}],"version-history":[{"count":0,"href":"https:\/\/www.zuola.com\/weblog\/wp-json\/wp\/v2\/posts\/1866\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zuola.com\/weblog\/wp-json\/wp\/v2\/media?parent=1866"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zuola.com\/weblog\/wp-json\/wp\/v2\/categories?post=1866"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zuola.com\/weblog\/wp-json\/wp\/v2\/tags?post=1866"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}