{"id":22,"date":"2014-10-31T02:27:45","date_gmt":"2014-10-30T18:27:45","guid":{"rendered":"http:\/\/blog.haostudio.net\/hwp\/?p=22"},"modified":"2017-07-25T00:24:57","modified_gmt":"2017-07-24T16:24:57","slug":"%e5%9c%a8cubieboard-%e4%b8%8a%e5%ae%89%e8%a3%9dlamp-server","status":"publish","type":"post","link":"https:\/\/blog.haostudio.net\/hwp\/%e5%9c%a8cubieboard-%e4%b8%8a%e5%ae%89%e8%a3%9dlamp-server\/","title":{"rendered":"\u5728Cubieboard \u4e0a\u5b89\u88ddLAMP server"},"content":{"rendered":"<!--more-->\n<h2>\u5728Cubieboard \u4e0a\u5b89\u88ddLAMP server (Linux, Apache, MySQL, PHP)<\/h2>\n<h1>\u5b89\u88ddMySQL<\/h1>\n<p>\u9996\u5148\u5148\u66f4\u65b0\u4e00\u4e0b\u5957\u4ef6\u8cc7\u8a0a<\/p>\n<pre><code>server# aptitude update &amp;&amp; aptitude upgrade\n<\/code><\/pre>\n<p>\u5b89\u88ddMySQL\u5957\u4ef6, \u5728\u5b89\u88dd\u904e\u7a0b\u4e2d, \u6703\u8981\u6c42\u4f60\u5efa\u7acbMySQL root \u7684\u5bc6\u78bc.<\/p>\n<pre><code>server# apt-get install mysql-server mysql-client\n<\/code><\/pre>\n<p>\u82e5\u6c92\u6709\u5efa\u7acbMySQL root \u5bc6\u78bc, \u4e5f\u53ef\u4ee5\u4e8b\u5f8c\u7528\u4e0b\u5217\u6307\u4ee4\u4f86\u5efa\u7acb:<\/p>\n<pre><code>server# \/usr\/bin\/mysqladmin -u root password &#039;enter-your-good-new-password-here&#039;\n<\/code><\/pre>\n<h1>\u5b89\u88ddApache2<\/h1>\n<p>\u5b89\u88ddApache\u5957\u4ef6<\/p>\n<pre><code>server# apt-get install apache2 apache2-doc\n<\/code><\/pre>\n<h1>\u5b89\u88ddPHP<\/h1>\n<p>\u5b89\u88ddPHP\u5957\u4ef6<\/p>\n<pre><code>server# apt-get install php5 php5-mysql libapache2-mod-php5\n<\/code><\/pre>\n<p>\u4e7e\u8106\u9806\u4fbf\u5b89\u88ddapache \u7684perl, python \u5957\u4ef6\u597d\u4e86<\/p>\n<pre><code>server# apt-get install perl libapache2-mod-perl2\nserver# apt-get install python libapache2-mod-python\n<\/code><\/pre>\n<h1>\u8b93\u4f7f\u7528\u8005\u4e5f\u53ef\u4ee5\u5728\u81ea\u5df1\u7684Home Directory \u5efa\u7acb\u7db2\u9801<\/h1>\n<p>\u555f\u7528apach2 \u7684 userdir \u6a21\u7d44<\/p>\n<pre><code>server# a2enmod userdir\n<\/code><\/pre>\n<p>\u4fee\u6539\/etc\/apache2\/mods-enabled\/userdir.conf \u6a94\u6848\u5982\u4e0b, \u8acb\u8996\u81ea\u5df1\u9700\u6c42\u800c\u4fee\u6539.<\/p>\n<pre><code>&lt;IfModule mod_userdir.c&gt;\n        UserDir public_html\n        UserDir disabled root\n\n        &lt;Directory \/home\/*\/public_html&gt;\n                AllowOverride FileInfo AuthConfig Limit Indexes\n                Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec\n                &lt;Limit GET POST OPTIONS&gt;\n                        Order allow,deny\n                        Allow from all\n                &lt;\/Limit&gt;\n                &lt;LimitExcept GET POST OPTIONS&gt;\n                        Order deny,allow\n                        Deny from all\n                &lt;\/LimitExcept&gt;\n        &lt;\/Directory&gt;\n&lt;\/IfModule&gt;\n<\/code><\/pre>\n<p>\u7136\u5f8c\u5728User\u7684Home Directory \u4e0b\u5efa\u7acbpubli_html \u76ee\u9304(\u4e0d\u9700\u662froot)<\/p>\n<pre><code>server$ mkdir \/home\/$USER\/public_html\n<\/code><\/pre>\n<p>\u4fee\u6539\u6b64\u76ee\u9304\u7684group \u70bawww-data (\u9700\u8981\u662froot \u624d\u80fd\u505a)<\/p>\n<pre><code>server# chgrp www-data \/home\/&lt;username&gt;\/public_html\n<\/code><\/pre>\n<p>\u4e26\u4e14\u78ba\u5b9a\u4f7f\u7528\u8005\u7684Home directory \u6b0a\u9650\u5fc5\u9808\u662f755, \u4e0d\u7136apache \u7121\u6cd5\u5b58\u53d6\u7684public_html \u76ee\u9304<\/p>\n<pre><code>server# chmod 755 \/home\/&lt;username&gt;\n<\/code><\/pre>\n<p>\u82e5\u8981\u8b93\u4f7f\u7528\u8005\u4e5f\u53ef\u4ee5\u7528php, \u5247\u4fee\u6539\/etc\/apache2\/mods-available\/php5.conf, \u628a\u4e0b\u5217\u5e7e\u884c\u7d66\u8a3b\u89e3\u8d77\u4f86<\/p>\n<pre><code>#&lt;IfModule mod_userdir.c&gt;\n1.    &lt;Directory \/home\/*\/public_html&gt;\n1.        php_admin_value engine Off\n1.    &lt;\/Directory&gt;\n#&lt;\/IfModule&gt;\n<\/code><\/pre>\n<p>\u7136\u5f8c\u91cd\u65b0\u555f\u52d5apache\u5373\u53ef<\/p>\n<pre><code>server# \/etc\/init.d\/apache2 restart\n<\/code><\/pre>\n<h1>\u5b89\u88ddphpMyAdmin<\/h1>\n<pre><code>server# apt-get install phpmyadmin\n<\/code><\/pre>\n<p>\u5b89\u88dd\u671f\u9593, \u4ed6\u6703\u554f\u4f60\u76ee\u524d\u4f7f\u7528http server\u7684\u7a0b\u5f0f\u662fApache or \u5176\u4ed6, \u9078Apache \u5c31\u5c0d\u4e86.<\/p>\n<p>\u63a5\u4e0b\u4f86\u4ed6\u6703\u554f\u4f60MySql \u7684root \u5bc6\u78bc.<\/p>\n<p>\u518d\u63a5\u4e0b\u4f86\u4ed6\u6703\u554f\u4f60\u8981\u9032\u5165phpMyAdmin\u7684\u5bc6\u78bc \uff08\u6ce8\u610f: \u5e33\u865f\u540d\u7a31\u70baphpmyadmin).<\/p>\n<p>\u7136\u5f8c\u4f7f\u7528Browser \u9023\u7dda\n<em><a href=\"http:\/\/your_ip\/phpmyadmin\">http:\/\/your_ip\/phpmyadmin<\/a><\/em> \u5373\u53ef.<\/p>\n<p>\u9023\u9032\u53bb\u5f8c, \u4f60\u53ef\u4ee5\u4f7f\u7528MySQL \u7684root \u5e33\u5bc6\u767b\u5165, \u6216\u8005\u662fphpmyadmin \u7684\u5e33\u5bc6\u767b\u5165.\nMySql root \u7684\u5e33\u865f\u64c1\u6709\u5168\u90e8\u6b0a\u9650, \u4f46\u662fphpmyadmin \u5e33\u865f\u7684\u6b0a\u9650\u6709\u9650\u5236.<\/p>\n<h1>Apache, PHP, MySQL, phpMyAdmin \u7684\u8a2d\u5b9a\u6a94<\/h1>\n<p>\u8a2d\u5b9a\u6a94\u5982\u4e0b, \u88e1\u9762\u6709\u8a73\u7d30\u8aaa\u660e, \u8acb\u8996\u60c5\u6cc1\u4fee\u6539\u5176\u5167\u5bb9.<\/p>\n<pre><code>\/etc\/apache2\/apache2.conf\n\/etc\/php5\/apache2\/php.ini\n\/etc\/mysql\/my.cnf\n\/etc\/phpmyadmin\/apache.conf   (\u9019\u500b\u6a94\u6703\u88ablink\u5230\/etc\/apache2\/conf.d\/phpmyadmin.conf)\n<\/code><\/pre>\n<h1>\u5728PHP \u4e2d\u4f7f\u7528MySQL<\/h1>\n<p>\u55ef&#8230;\u597d\u50cfphp default \u5c31\u6703\u4f7f\u7528mysql \u4e86, \u4e0d\u9700\u518d\u984d\u5916\u8a2d\u5b9a<\/p>\n<h1>Apache Virtual Host \u8a2d\u5b9a<\/h1>\n<p>\u5728\/etc\/apache2\/sites-available \u76ee\u9304\u4e0b\u5efa\u7acbvirtual host \u8a2d\u5b9a\u6a94. \u5efa\u8b70\u6a94\u8ddfdomain name \u4e00\u6a23. \u6bd4\u8f03\u597d\u7ba1\u7406.\n\u5047\u8a2d\u4f60\u7684virtual host \u7684domain name \u662fwww.myblog.idv.tw. \u90a3\u9ebc\u8a2d\u5b9a\u6a94\u540d\u5c31\u662fwww.myblog.idv.tw\n\u5176\u5167\u5bb9\u5982\u4e0b:<\/p>\n<pre><code>&lt;VirtualHost *:80&gt;\n        ServerAdmin  your-email@mail_addr.com     ### Your email address\n\n        DocumentRoot \/www\/myblog\/html             #### \u5b58\u653e\u7db2\u9801\u7684\u76ee\u9304\n        ServerName www.myblog.idv.tw              ### \u4f60\u7684virtual host \u7684domain name\n        AddDefaultCharset UTF-8\n        &lt;Directory \/&gt;\n                Options FollowSymLinks\n                AllowOverride All\n        &lt;\/Directory&gt;\n        &lt;Directory \/var\/www\/&gt;\n                Options Indexes FollowSymLinks MultiViews\n                AllowOverride None\n                Order allow,deny\n                allow from all\n        &lt;\/Directory&gt;\n\n        ScriptAlias \/cgi-bin\/ \/usr\/lib\/cgi-bin\/\n        &lt;Directory &quot;\/usr\/lib\/cgi-bin&quot;&gt;\n                AllowOverride None\n                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch\n                Order allow,deny\n                Allow from all\n        &lt;\/Directory&gt;\n\n        ErrorLog \/www\/log\/error.log                  ### Error \u7684\u8a18\u9304\u6848\n\n        1. Possible values include: debug, info, notice, warn, error, crit,\n        1. alert, emerg.\n        LogLevel warn\n\n        CustomLog \/www\/log\/access.log combined    ### Access \u7684\u8a18\u9304\u6a94\n&lt;\/VirtualHost&gt;\n<\/code><\/pre>\n<p>\u7136\u5f8c\u5728\/etc\/apache2\/sites-enable \u76ee\u9304\u4e0b\u5efa\u7acb\u4e0a\u8ff0\u6a94\u6848\u7684link<\/p>\n<pre><code>server# cd \/etc\/apache2\/sites-enable\nserver# ln -s ..\/www.myblog.idv.tw 100-www.myblog.idv.tw\n<\/code><\/pre>\n<p>\u9019\u500blink \u7684\u524d3\u70ba\u6578\u5b57\u597d\u50cf\u6c92\u5565\u4f5c\u7528, \u6211\u53ea\u662f\u7167\u8457\u6b64\u76ee\u9304\u7684\u7fd2\u6163\u4f86\u505a\u800c\u5df2, \u7d14\u7cb9\u597d\u770b.<\/p>\n<h1>\u555f\u7528Apache\u984d\u5916\u7684module<\/h1>\n<p>\u5c07\u8981\u555f\u7528\u7684module \u5728\/etc\/apache2\/modes-enable \u5efa\u7acblink\u5373\u53ef<\/p>\n<p>\u4f8b\u5982\u6211\u60f3\u555f\u7528\/etc\/apapche2\/rewrite.load \u9019\u500bmodule, \u53ea\u8981\u5982\u4e0b\u8a2d\u5b9a\u4e26\u91cd\u65b0\u555f\u52d5apache<\/p>\n<pre><code>server# cd \/etc\/apache2\/mods-enable\nserver# ln -s ..\/mods-available\/rewrite.load rewrite.load\nserver# \/etc\/init.d\/apache2 restart\n<\/code><\/pre>\n<hr \/>\n<h3>\u53c3\u8003\u8cc7\u6599<\/h3>\n<ol>\n<li><a href=\"https:\/\/wiki.debian.org\/LaMp#Installation\">LAMP, Linux Apache MySQL PHP<\/a><\/li>\n<li><a href=\"http:\/\/httpd.apache.org\/docs\/current\/vhosts\/examples.html\">VirtualHost Examples<\/a><\/li>\n<\/ol>","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,12],"tags":[11,13],"class_list":["post-22","post","type-post","status-publish","format-standard","hentry","category-embedded-system","category-12","tag-cubieboard","tag-lamp"],"_links":{"self":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts\/22","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/comments?post=22"}],"version-history":[{"count":4,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts\/22\/revisions"}],"predecessor-version":[{"id":421,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts\/22\/revisions\/421"}],"wp:attachment":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/media?parent=22"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/categories?post=22"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/tags?post=22"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}