{"id":8774,"date":"2018-12-06T01:14:27","date_gmt":"2018-12-05T17:14:27","guid":{"rendered":"http:\/\/4563.org\/?p=8774"},"modified":"2018-12-06T01:14:27","modified_gmt":"2018-12-05T17:14:27","slug":"debian-8%e5%ae%89%e8%a3%85lamp%ef%bc%88linux-apache-mysql-php%ef%bc%89web%e7%bd%91%e7%ab%99%e7%8e%af%e5%a2%83","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=8774","title":{"rendered":"Debian 8\u5b89\u88c5LAMP\uff08Linux, Apache, MySql, PHP\uff09Web\u7f51\u7ad9\u73af\u5883"},"content":{"rendered":"<p>Debian 8\u7cfb\u7edf\u90e8\u7f72LAMP\uff08Linux, Apache, MySql, PHP\uff09\u5b9e\u73b0\u7b80\u5355\u7f51\u7ad9\u5e94\u7528!<\/p>\n<h2 id=\"title-0\">\u7b2c\u4e00\u6b65\u3001\u66f4\u65b0\u7cfb\u7edf\u8f6f\u4ef6\u5305<\/h2>\n<blockquote><p>apt-get update -y &amp;&amp; apt-get upgrade -y<\/p><\/blockquote>\n<p>\u8fd9\u4e00\u6b65\u4e0d\u53ef\u5c11\uff0c\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u6211\u4eec\u5f53\u524d\u7cfb\u7edf\u7684\u8f6f\u4ef6\u3001\u8865\u4e01\u90fd\u662f\u6700\u65b0\u7684\u3002\u56e0\u4e3a\u4e0d\u80fd\u786e\u4fdd\u5546\u5bb6\u7ed9\u6211\u4eec\u63d0\u4f9b\u7684\u5305\u662f\u6700\u65b0\u7248\u672c\uff0c\u6709\u4e9b\u53ef\u80fd\u8fd8\u4f1a\u6709\u6f0f\u6d1e\u3002<\/p>\n<h2 id=\"title-1\">\u7b2c\u4e8c\u6b65\u3001Apache\u90e8\u5206\u5b89\u88c5\u548c\u914d\u7f6e<\/h2>\n<p>1\u3001\u5b89\u88c5Apache 2.4<\/p>\n<blockquote><p>apt-get install apache2 -y<\/p><\/blockquote>\n<p>2\u3001\u5173\u95edKeepAlive<\/p>\n<p>\u5173\u4e8eKeepAlive\u7684\u89e3\u91ca\u7f51\u4e0a\u6709\u4ecb\u7ecd\uff0c\u8001\u848b\u4e5f\u987a\u5e26\u5b66\u4e60\u540e\u51b3\u5b9a\u8fd8\u662f\u5173\u95ed\u3002\u5982\u679c\u670d\u52a1\u5668\u914d\u7f6e\u53ef\u4ee5\uff0c\u4ee5\u53ca\u9700\u8981\u5904\u7406\u8f83\u591a\u9759\u6001\u5185\u5bb9\uff0c\u53ef\u4ee5\u5f00\u542f\uff0c\u5982\u679c\u662f\u52a8\u6001\u5185\u5bb9\u4e14\u914d\u7f6e\u4e0d\u9ad8\u90a3\u5c31\u5173\u95ed\u3002<\/p>\n<blockquote><p>\/etc\/apache2\/apache2.conf<\/p><\/blockquote>\n<p>vi\u7f16\u8bd1apache2.conf\u6587\u4ef6\uff0c\u627e\u5230 KeepAlive On\uff0c\u5c06\u4fee\u6539\u6210 KeepAlive Off\uff0c\u7136\u540e\u4fdd\u5b58\u9000\u51fa\u3002<\/p>\n<p>3\u3001\u5173\u95ed\u4e0d\u5fc5\u8981\u7684\u6a21\u5757<\/p>\n<blockquote><p>a2dismod mpm_event<br \/>\na2enmod mpm_prefork<\/p><\/blockquote>\n<p>4\u3001\u91cd\u542fapache<\/p>\n<blockquote><p>systemctl restart apache2<\/p><\/blockquote>\n<p>\u91cd\u542f\u4e4b\u540e\uff0c\u6211\u4eec\u76f4\u63a5\u5728\u6d4f\u89c8\u5668\u4e2d\u8f93\u5165\u5f53\u524d\u670d\u52a1\u5668IP\u5730\u5740\uff0c\u53ef\u4ee5\u770b\u5230\u9ed8\u8ba4\u7684Apache2\u754c\u9762\uff0c\u8fd9\u8bf4\u660eApache\u5df2\u7ecf\u5b89\u88c5\u5b8c\u6bd5\u3002\u9ed8\u8ba4\u6839\u76ee\u5f55\u5728&#8221;\/var\/www\/html&#8221;\u4e2d\uff0c\u5982\u679c\u6211\u4eec\u9700\u8981\u66ff\u6362\u5176\u4ed6\u9875\u9762\u4e5f\u662f\u53ef\u4ee5\u7684\uff0c\u6bd4\u5982\u6709\u4e9b\u7f51\u53cb\u559c\u6b22\u6839\u76ee\u5f55\u642d\u5efa\u4e2a\u7ad9\u70b9\u76ee\u5f55\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-8775\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2018\/12\/20181205_171332.png\" alt=\"\" width=\"624\" height=\"339\" \/><\/p>\n<h2 id=\"title-2\">\u7b2c\u4e09\u6b65\u3001\u914d\u7f6e\u7ad9\u70b9\u4e3b\u673a\u7ed1\u5b9a\u57df\u540d<\/h2>\n<p>1\u3001\u521b\u5efa\u7ad9\u70b9\u6587\u4ef6\u76ee\u5f55\u548c\u65e5\u5fd7\u76ee\u5f55<\/p>\n<blockquote><p>mkdir -p \/var\/www\/itbulu.com\/public_html<br \/>\nmkdir \/var\/www\/itbulu.com\/logs<\/p><\/blockquote>\n<p>\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u5b9e\u9645\u60c5\u51b5\uff0c\u4ee5\u53ca\u4e2a\u4eba\u559c\u6b22\uff0c\u5c06\u7f51\u7ad9\u6587\u4ef6\u76ee\u5f55\u548c\u7f51\u7ad9\u65e5\u5fd7\u76ee\u5f55\u521b\u5efa\u3002\u5c06\u6807\u6ce8\u7684\u57df\u540d\u6587\u4ef6\u5939\u6362\u6210\u6211\u4eec\u81ea\u5df1\u7684\uff0c\u8fd9\u6837\u4ee5\u540e\u53ef\u4ee5\u533a\u5206\u5230\u54ea\u4e2a\u76ee\u5f55\u662f\u54ea\u4e2a\u7f51\u7ad9\u3002<\/p>\n<p>2\u3001\u521b\u5efa\u7ad9\u70b9\u914d\u7f6e\u6587\u4ef6<\/p>\n<blockquote><p>vi \/etc\/apache2\/sites-available\/itbulu.com.conf<\/p><\/blockquote>\n<p>\u7136\u540e\u5c06\u4e0b\u9762\u7684\u914d\u7f6e\u6587\u4ef6\u4e22\u8fdb\u53bb\uff0c\u8bb0\u5f97\u628a\u57df\u540d\u548c\u76ee\u5f55\u6362\u6210\u6211\u4eec\u81ea\u5df1\u7684\u3002<\/p>\n<blockquote><p>&lt;VirtualHost *:80&gt;<br \/>\nServerAdmin webmaster@example.com<br \/>\nServerName itbulu.com<br \/>\nServerAlias www.itbulu.com<br \/>\nDocumentRoot \/var\/www\/itbulu.com\/public_html\/<br \/>\nErrorLog \/var\/www\/itbulu.com\/logs\/error.log<br \/>\nCustomLog \/var\/www\/itbulu.com\/logs\/access.log combined<br \/>\n&lt;\/VirtualHost&gt;<\/p><\/blockquote>\n<p>3\u3001\u542f\u52a8\u914d\u7f6e\u751f\u6548<\/p>\n<blockquote><p>a2ensite itbulu.com.conf<\/p><\/blockquote>\n<p>\u5982\u679c\u9700\u8981\u7981\u6b62\u7ad9\u70b9\u53ef\u4ee5\u7528&#8221;a2dissite itbulu.com&#8221;\u3002<\/p>\n<p>4\u3001\u91cd\u542fApache<\/p>\n<blockquote><p>systemctl restart apache2<\/p><\/blockquote>\n<p>\u5982\u679c\u6ca1\u6709\u62a5\u9519\uff0c\u8bf4\u660e\u5c31\u6ca1\u6709\u95ee\u9898\u3002\u7136\u540e\u6211\u4eec\u53ef\u4ee5\u5c06HTML\u9875\u9762\u653e\u5230\u5f53\u524d\u7ad9\u70b9\u76ee\u5f55\uff0c\u57df\u540d\u7ed1\u5b9a\u540e\u5c31\u53ef\u4ee5\u6253\u5f00\u3002\u56e0\u4e3a\u6211\u4eec\u8fd8\u6ca1\u6709\u5b89\u88c5PHP\uff0c\u6240\u4ee5\u65e0\u6cd5\u6267\u884cPHP\u6587\u4ef6\u3002<\/p>\n<h2 id=\"title-3\">\u7b2c\u56db\u6b65\u3001MySQL\u6570\u636e\u5e93\u5b89\u88c5\u548c\u914d\u7f6e\u90e8\u5206<\/h2>\n<p>1\u3001\u5b89\u88c5MySQL\u6570\u636e\u5e93<\/p>\n<blockquote><p>apt-get install mysql-server -y<\/p><\/blockquote>\n<p>\u8fd0\u884c\u5b89\u88c5\u6570\u636e\u5e93\uff0c\u7136\u540e\u4f1a\u5f39\u51fa\u8f93\u5165\u6570\u636e\u5e93\u7ba1\u7406\u5bc6\u7801\u7684\u754c\u9762\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-8776\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2018\/12\/20181205_171344.png\" alt=\"\" width=\"561\" height=\"195\" \/><\/p>\n<p>\u5bc6\u7801\u9700\u8981\u8f93\u5165\u4e24\u6b21\uff0c\u56de\u8f66\u540e\u7ee7\u7eed\u81ea\u52a8\u5b89\u88c5\u6570\u636e\u5e93\u3002<\/p>\n<p>2\u3001\u6570\u636e\u5e93\u5b89\u5168\u914d\u7f6e<\/p>\n<blockquote><p>mysql_secure_installation<\/p><\/blockquote>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-8777\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2018\/12\/20181205_171354.png\" alt=\"\" width=\"604\" height=\"374\" \/><\/p>\n<p>\u8fd9\u91cc\u5728\u8bbe\u7f6e\u6570\u636e\u5e93\u5b89\u5168\u914d\u7f6e\u7684\u65f6\u5019\uff0c\u6211\u4eec\u5f00\u59cb\u8981\u8f93\u5165\u5f53\u524d\u6570\u636e\u5e93\u5bc6\u7801\uff0c\u5982\u679c\u6211\u4eec\u5f53\u521d\u4e0a\u9762\u8bbe\u7f6e\u8fc7\u65b0\u5bc6\u7801\u7684\uff0c\u90a3\u6211\u4eec\u5c31\u4e0d\u9700\u8981\u4fee\u6539\u3002\u5176\u4ed6\u914d\u7f6e\u90fd\u8f93\u5165Y\uff0c\u7136\u540e\u56de\u8f66\u3002<\/p>\n<p>3\u3001\u6dfb\u52a0\u6570\u636e\u5e93\u7528\u6237<\/p>\n<blockquote><p>mysql -u root -p<\/p><\/blockquote>\n<p>\u5982\u679c\u6211\u4eec\u5efa\u7ad9\u70b9\u9700\u8981\uff0c\u90a3\u5219\u9700\u8981\u901a\u8fc7\u4e0a\u9762\u547d\u4ee4\u8fdb\u5165\u6570\u636e\u5e93\u7ba1\u7406\uff0c\u6dfb\u52a0\u6570\u636e\u5e93\u7528\u6237\u7136\u540e\u6388\u6743\uff0c\u6216\u8005\u6211\u4eec\u4ee5\u540e\u4e5f\u53ef\u4ee5\u5b89\u88c5PHPMyAdmin\u8fdb\u884c\u6570\u636e\u5e93\u7ba1\u7406\u3002<\/p>\n<h2 id=\"title-4\">\u7b2c\u4e94\u6b65\u3001PHP\u5b89\u88c5\u914d\u7f6e\u8fc7\u7a0b<\/h2>\n<p>1\u3001\u5b89\u88c5PHP<\/p>\n<blockquote><p>apt-get install php5 php-pear -y<\/p><\/blockquote>\n<p>2\u3001\u521b\u5efaPHP\u65e5\u5fd7\u76ee\u5f55\uff0c\u8d4b\u4e88Apache\u7528\u6237\u6240\u6709\u6743<\/p>\n<blockquote><p>mkdir \/var\/log\/php<\/p>\n<p>chown www-data \/var\/log\/php<\/p><\/blockquote>\n<p>3\u3001\u9700\u8981PHP\u652f\u6301MySQL<\/p>\n<blockquote><p>apt-get install php5-mysql -y<\/p><\/blockquote>\n<p>4\u3001\u91cd\u542fApache<\/p>\n<blockquote><p>systemctl restart apache2<\/p><\/blockquote>\n<h2 id=\"title-5\">\u7b2c\u516d\u3001Debian8\u5b89\u88c5LAMP\u5c0f\u7ed3<\/h2>\n<p>\u8fd9\u6837\uff0c\u6211\u4eec\u968f\u4fbf\u4e22\u4e00\u4e2aPHP\u9875\u9762\u5230\u7ad9\u70b9\u76ee\u5f55\uff0c\u6216\u8005\u7ed1\u5b9a\u7684\u57df\u540d\u76ee\u5f55\u4e2d\uff0c\u53ef\u4ee5\u770b\u5230\u5f53\u524dWEB\u73af\u5883\u652f\u6301PHP\u3001MYSQL\u6570\u636e\u5e93\u3002\u8fd9\u4e48\u4e00\u4e2a\u7b80\u5355\u7684LAMP\u73af\u5883\u5c31\u5b89\u88c5\u5b8c\u6bd5\u3002\u5f53\u7136\uff0c\u8fd9\u4e2a\u53ea\u80fd\u7b97\u662f\u6bd4\u8f83\u7b80\u5355\u7684\u529f\u80fd\uff0c\u5bf9\u4e8e\u6709\u9700\u8981\u7279\u6b8a\u7ec4\u4ef6\u652f\u6301\u3001\u6269\u5c55\u5305\u7684\uff0c\u8fd8\u9700\u8981\u91cd\u65b0\u7f16\u8bd1PHP\u4f7f\u4e4b\u517c\u5bb9\u3002<\/p>\n<p>\u4f86\u6e90:https:\/\/www.itbulu.com\/debian8-lamp.html<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Debian 8\u7cfb\u7edf\u90e8\u7f72LAMP\uff08&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/8774"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8774"}],"version-history":[{"count":1,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/8774\/revisions"}],"predecessor-version":[{"id":8778,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/8774\/revisions\/8778"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8774"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8774"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8774"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}