﻿{"id":64,"date":"2016-03-07T22:20:48","date_gmt":"2016-03-07T14:20:48","guid":{"rendered":"http:\/\/www.chenweikang.top\/?p=64"},"modified":"2016-03-07T22:21:15","modified_gmt":"2016-03-07T14:21:15","slug":"centos-7%e4%b8%8b%e6%90%ad%e5%bb%balamp%e5%b9%b3%e5%8f%b0%e7%8e%af%e5%a2%83","status":"publish","type":"post","link":"https:\/\/www.chenweikang.top\/?p=64","title":{"rendered":"CentOS 7\u4e0b\u642d\u5efaLAMP\u5e73\u53f0\u73af\u5883"},"content":{"rendered":"<blockquote><p><a title=\"CentOS\" href=\"http:\/\/www.linuxidc.com\/topicnews.aspx?tid=14\" target=\"_blank\">CentOS<\/a>\u53d1\u5e037.0\u7248\u672c\uff0c\u65b0\u7248\u672c\u5e26\u6765\u5f88\u591a\u7279\u6027\uff0c\u9664\u4e86\u5185\u6838\u66f4\u65b0\u52303.10\u5916\uff0c\u652f\u6301 Linux \u5bb9\u5668\u3001Open VMware Tools \u53ca 3D \u56fe\u50cf\u80fd\u5373\u88c5\u5373\u7528\uff0c\u8f6c\u7528 systemd\u3001firewalld \u53ca GRUB2 \uff0c\u800c\u9ed8\u8ba4\u7684\u6587\u4ef6\u7cfb\u7edf\u4e3aXFS\u7b49\u7b49,\u53ef\u4ee5\u8bf4\u662f\u6bd4\u8f83\u91cd\u5927\u7684\u5347\u7ea7\u3002\u7b14\u8005\u5c1d\u8bd5\u4e86\u4f7f\u7528Centos7\u642d\u5efaLAMP\u670d\u52a1\u5668\u5e73\u53f0\uff0c\u8bb0\u5f55\u5982\u4e0b\u3002<\/p><\/blockquote>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-65\" src=\"http:\/\/www.chenweikang.top\/wp-content\/uploads\/2016\/03\/lamp.jpg\" alt=\"lamp\" width=\"580\" height=\"290\" \/><\/p>\n<p>1.\u542f\u7528Apache2<\/p>\n<p>Centos7\u9ed8\u8ba4\u5df2\u7ecf\u5b89\u88c5httpd\u670d\u52a1\uff0c\u53ea\u662f\u6ca1\u6709\u542f\u52a8\u3002\u5982\u679c\u4f60\u9700\u8981\u5168\u65b0\u5b89\u88c5\uff0c\u53ef\u4ee5yum install -y httpd<\/p>\n<p>\u542f\u52a8\u670d\u52a1\uff1asystemctl start httpd.service<\/p>\n<p>\u8bbe\u7f6e\u5f00\u673a\u81ea\u52a8\u542f\u52a8\uff1asystemctl enable httpd.service<\/p>\n<p>HTTP\u670d\u52a1\u5668\u5df2\u7ecf\u542f\u52a8\uff0c\u8fdb\u884c\u4e00\u4e0b\u7b80\u5355\u914d\u7f6e<\/p>\n<p>vi \/etc\/httpd\/conf\/httpd.conf #\u7f16\u8f91\u6587\u4ef6<\/p>\n<p>ServerSignature On\u00a0 #\u6dfb\u52a0\uff0c\u5728\u9519\u8bef\u9875\u4e2d\u663e\u793aApache\u7684\u7248\u672c\uff0cOff\u4e3a\u4e0d\u663e\u793a<\/p>\n<p>Options Indexes FollowSymLinks\u00a0 #\u4fee\u6539\u4e3a\uff1aOptions Includes ExecCGI FollowSymLinks\uff08\u5141\u8bb8\u670d\u52a1\u5668\u6267\u884cCGI\u53caSSI\uff0c\u7981\u6b62\u5217\u51fa\u76ee\u5f55\uff09<\/p>\n<p>#AddHandler cgi-script .cgi\u3000#\u4fee\u6539\u4e3a\uff1aAddHandler cgi-script .cgi .pl \uff08\u5141\u8bb8\u6269\u5c55\u540d\u4e3a.pl\u7684CGI\u811a\u672c\u8fd0\u884c\uff09<\/p>\n<p>AllowOverride None\u3000 #\u4fee\u6539\u4e3a\uff1aAllowOverride All \uff08\u5141\u8bb8.htaccess\uff09<\/p>\n<p>AddDefaultCharset UTF-8\u3000#\u4fee\u6539\u4e3a\uff1aAddDefaultCharset GB2312\u3000\uff08\u6dfb\u52a0GB2312\u4e3a\u9ed8\u8ba4\u7f16\u7801\uff09<\/p>\n<p>#Options Indexes FollowSymLinks\u00a0 #\u4fee\u6539\u4e3a Options FollowSymLinks\uff08\u4e0d\u5728\u6d4f\u89c8\u5668\u4e0a\u663e\u793a\u6811\u72b6\u76ee\u5f55\u7ed3\u6784\uff09<\/p>\n<p>DirectoryIndex index.html\u00a0 #\u4fee\u6539\u4e3a\uff1aDirectoryIndex index.html index.htm Default.html Default.htm index.php\uff08\u8bbe\u7f6e\u9ed8\u8ba4\u9996\u9875\u6587\u4ef6\uff0c\u589e\u52a0index.php\uff09<\/p>\n<p>MaxKeepAliveRequests 500\u00a0 #\u6dfb\u52a0MaxKeepAliveRequests 500 \uff08\u589e\u52a0\u540c\u65f6\u8fde\u63a5\u6570\uff09<\/p>\n<p>:wq! #\u4fdd\u5b58\u9000\u51fa<\/p>\n<p>systemctl restart httpd.service #\u91cd\u542fapache<\/p>\n<p>rm -f \/etc\/httpd\/conf.d\/welcome.conf \/var\/www\/error\/noindex.html #\u5220\u9664\u9ed8\u8ba4\u6d4b\u8bd5\u9875<\/p>\n<p>2.\u8bbe\u7f6e\u9632\u706b\u5899<\/p>\n<p>Centos7\u4e0b\u7684\u9632\u706b\u5899\u5df2\u7ecf\u7531iptables\u6539\u4e3afirewall\uff0c\u4f7f\u7528firewall-cmd\u547d\u4ee4\u5f00\u653e80\u53ca443\u7aef\u53e3:<\/p>\n<p>firewall-cmd \u2013permanent \u2013zone=public \u2013add-service=http<\/p>\n<p>firewall-cmd \u2013permanent \u2013zone=public \u2013add-service=https<\/p>\n<p>firewall-cmd \u2013reload<\/p>\n<p>\u8bbe\u7f6eSELinux\u4e3apermissive\u6a21\u5f0f \u547d\u4ee4\u884c\u4e0b setenforce 0 \u7acb\u5373\u751f\u6548\uff0c\u91cd\u542f\u5931\u6548\u3002<\/p>\n<p>\u7f16\u8f91 vim\/etc\/sysconfig\/selinux\u00a0 SELinux=enforcing \u4fee\u6539\u4e3adisabled \u5173\u95edSELinux\uff0c\u91cd\u542f\u6c38\u4e45\u751f\u6548\u3002<\/p>\n<p>\u7b14\u8005ip\u4e3a192.168.1.108\uff0c\u6d4b\u8bd5\u4e0b\u670d\u52a1\u5668\u80fd\u5426\u6253\u5f00\uff0c\u6d4f\u89c8\u5668http:\/\/192.168.1.108\u56de\u8f66\u540e\u770b\u5230\u6b22\u8fce\u9875\u9762\uff0c\u8bf4\u660e\u670d\u52a1\u5668\u6b63\u5e38\u8fd0\u884c\u3002<\/p>\n<p>3.\u5b89\u88c5MariaDB\u6570\u636e\u5e93<\/p>\n<p>CentOS 7.0\u4e2d\uff0c\u5df2\u7ecf\u4f7f\u7528MariaDB\u66ff\u4ee3\u4e86MySQL\u6570\u636e\u5e93,\u539f\u56e0\u4f60\u61c2\u7684,MYSQL\u88ab<a title=\"Oracle\" href=\"http:\/\/www.linuxidc.com\/topicnews.aspx?tid=12\" target=\"_blank\">Oracle<\/a>\u6536\u8d2d\u4ee5\u540e\uff0c\u524d\u666f\u582a\u5fe7\uff0c\u6240\u4ee5MYSQL\u5144\u5f1fMariaDB\u5c31\u51fa\u6765\u4e86\uff0c\u7ee7\u7eed\u5f00\u6e90\u4e8b\u4e1a\u3002<\/p>\n<p>\u5b89\u88c5\uff1ayum -y install mariadb-server mariadb<\/p>\n<p>\u542f\u52a8\uff1asystemctl start mariadb.service<\/p>\n<p>systemctl enable mariadb.service<\/p>\n<p>\u914d\u7f6e\uff1acp \/usr\/share\/mysql\/my-huge.cnf \/etc\/my.cnf\u00a0 \u8986\u76d6\u539f\u914d\u7f6e\u5c31\u597d\u4e86\u3002<\/p>\n<p>\u8bbe\u7f6e\u6570\u636e\u5e93\u7ba1\u7406\u5458\u5bc6\u7801\uff1amysql_secure_installation\u00a0 \u4e00\u8defy\u5c31\u53ef\u4ee5\u4e86\uff0c\u5f53\u7136\u7b2c\u4e00\u6b21y\u540e\u9762\u8981\u8f93\u5165\u4e24\u6b21\u5bc6\u7801\u3002<\/p>\n<p>4.\u5b89\u88c5PHP5<\/p>\n<p>\u5b89\u88c5PHP\u4e3b\u7a0b\u5e8f\uff1a yum -y install php<\/p>\n<p>\u5b89\u88c5PHP\u7ec4\u4ef6\uff0c\u4f7fPHP\u652f\u6301 MariaDB<\/p>\n<p>yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel<\/p>\n<p>\u91cd\u542f\uff1a systemctl restart httpd.service<\/p>\n<p>\u914d\u7f6e\uff1a vi \/etc\/php.ini<\/p>\n<p>date.timezone = PRC #\u628a\u524d\u9762\u7684\u5206\u53f7\u53bb\u6389\uff0c\u6539\u4e3adate.timezone = PRC<\/p>\n<p>disable_functions = passthru,exec,system\u2026\u2026#\u5217\u51faPHP\u53ef\u4ee5\u7981\u7528\u7684\u51fd\u6570\uff0c\u5982\u679c\u67d0\u4e9b\u7a0b\u5e8f\u9700\u8981\u7528\u5230\u8fd9\u4e2a\u51fd\u6570\uff0c\u53ef\u4ee5\u5220\u9664\uff0c\u53d6\u6d88\u7981\u7528\u3002<\/p>\n<p>expose_php = Off #\u7981\u6b62\u663e\u793aphp\u7248\u672c\u7684\u4fe1\u606f<\/p>\n<p>short_open_tag = ON #\u652f\u6301php\u77ed\u6807\u7b7e<\/p>\n<p>open_basedir = .:\/tmp\/\u00a0 #\u8bbe\u7f6e\u8868\u793a\u5141\u8bb8\u8bbf\u95ee\u5f53\u524d\u76ee\u5f55(\u5373PHP\u811a\u672c\u6587\u4ef6\u6240\u5728\u4e4b\u76ee\u5f55)\u548c\/tmp\/\u76ee\u5f55,\u53ef\u4ee5\u9632\u6b62php\u6728\u9a6c\u8de8\u7ad9,\u5982\u679c\u6539\u4e86\u4e4b\u540e\u5b89\u88c5\u7a0b\u5e8f\u6709\u95ee\u9898(\u4f8b\u5982\uff1a\u7ec7\u68a6\u5185\u5bb9\u7ba1\u7406\u7cfb\u7edf)\uff0c\u53ef\u4ee5\u6ce8\u9500\u6b64\u884c\uff0c\u6216\u8005\u76f4\u63a5\u5199\u4e0a\u7a0b\u5e8f\u7684\u76ee\u5f55\/data\/www.osyunwei.com\/:\/tmp\/<\/p>\n<p>\u6d4b\u8bd5\u4e00\u4e0b\uff1avi \/var\/www\/html\/index.php\u00a0 \u8f93\u5165&lt;?php phpinfo(); ?&gt;\u00a0 wq\u4fdd\u5b58\u9000\u51fa\u3002\u6253\u5f00http:\/\/192.168.1.108 \u5982\u679c\u80fd\u770b\u5230PHP\u914d\u7f6e\u4fe1\u606f\u9875\uff0c\u8bf4\u660ePHP\u670d\u52a1\u5668\u6b63\u5e38\u3002<\/p>\n<p>\u81f3\u6b64\uff0cLAMP\u5e73\u53f0\u5c31\u642d\u5efa\u597d\u4e86\uff0c\u60a8\u53ef\u4ee5\u5728\u4e0a\u9762\u642d\u5efaWorldpress\u7f51\u7ad9\u4e86\uff0c\u5f53\u7136\uff0c\u5982\u679c\u4f60\u89c9\u5f97\u6570\u636e\u5e93\u7ba1\u7406\u8d77\u6765\u6bd4\u8f83\u9ebb\u70e6\u7684\u8bdd\uff0c\u4e5f\u53ef\u4ee5\u7528yum install phpMyAdmin\u5b89\u88c5\u56fe\u5f62\u5316\u7ba1\u7406\u5de5\u5177\u3002<\/p>\n<p>&nbsp;<\/p>\n<blockquote><p>CentOS 6.5\u7cfb\u7edf\u5b89\u88c5\u914d\u7f6eLAMP(Apache+PHP5+MySQL)\u670d\u52a1\u5668\u73af\u5883 <a href=\"http:\/\/www.linuxidc.com\/Linux\/2014-12\/111030.htm\">http:\/\/www.linuxidc.com\/Linux\/2014-12\/111030.htm<\/a><\/p>\n<p><a title=\"Ubuntu\" href=\"http:\/\/www.linuxidc.com\/topicnews.aspx?tid=2\" target=\"_blank\">Ubuntu<\/a> 14.04 \u914d\u7f6e LAMP+phpMyAdmin PHP(5.5.9)\u5f00\u53d1\u73af\u5883\u00a0 <a href=\"http:\/\/www.linuxidc.com\/Linux\/2014-10\/107924.htm\">http:\/\/www.linuxidc.com\/Linux\/2014-10\/107924.htm<\/a><\/p>\n<p>Windows 7\u4e0b\u786c\u76d8\u5b89\u88c5Ubuntu 14.10\u56fe\u6587\u6559\u7a0b <a href=\"http:\/\/www.linuxidc.com\/Linux\/2014-10\/108430.htm\">http:\/\/www.linuxidc.com\/Linux\/2014-10\/108430.htm<\/a><\/p>\n<p>U\u76d8\u5b89\u88c5Ubuntu 14.10 <a href=\"http:\/\/www.linuxidc.com\/Linux\/2014-10\/108402.htm\">http:\/\/www.linuxidc.com\/Linux\/2014-10\/108402.htm<\/a><\/p>\n<p>Ubuntu 14.10 \u6b63\u5f0f\u53d1\u5e03\u4e0b\u8f7d <a href=\"http:\/\/www.linuxidc.com\/Linux\/2014-10\/108363.htm\">http:\/\/www.linuxidc.com\/Linux\/2014-10\/108363.htm<\/a><\/p>\n<p>Ubuntu 14.04 LTS \u5982\u4f55\u5347\u7ea7\u5230 Ubuntu 14.10\u00a0 <a href=\"http:\/\/www.linuxidc.com\/Linux\/2014-10\/108381.htm\">http:\/\/www.linuxidc.com\/Linux\/2014-10\/108381.htm<\/a><\/p>\n<p>Ubuntu 14.10 \u4e0b\u5b89\u88c5 LAMP \u670d\u52a1\u56fe\u6587\u8be6\u89e3\u00a0 <a href=\"http:\/\/www.linuxidc.com\/Linux\/2014-12\/110082.htm\">http:\/\/www.linuxidc.com\/Linux\/2014-12\/110082.htm<\/a><\/p>\n<p>&nbsp;<\/p><\/blockquote>\n<p>\u66f4\u591aCentOS\u76f8\u5173\u4fe1\u606f\u89c1<a href=\"http:\/\/www.linuxidc.com\/topicnews.aspx?tid=14\" target=\"_self\">CentOS<\/a> \u4e13\u9898\u9875\u9762 <a title=\"CentOS\" href=\"http:\/\/www.linuxidc.com\/topicnews.aspx?tid=14\" target=\"\">http:\/\/www.linuxidc.com\/topicnews.aspx?tid=14<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\u6587\u7ae0\u6765\u6e90\uff1ahttp:\/\/www.linuxidc.com\/Linux\/2015-06\/118818.htm<\/p>\n<p>\u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1a<a href=\"https:\/\/www.chenweikang.top\">\u5de6\u624b\u4ee3\u7801\u53f3\u624b\u8bd7<\/a> &raquo; <a href=\"https:\/\/www.chenweikang.top\/?p=64\">CentOS 7\u4e0b\u642d\u5efaLAMP\u5e73\u53f0\u73af\u5883<\/a><\/p><div class=\"__youshang\">\r\n            <div id=\"__youshang_popup\" class=\"wechat popup\" style=\"display: none;\">\r\n                <div class=\"head\">~\u8c22\u8c22\u6253\u8d4f~<\/div>\r\n                <div class=\"qrcode\"><div class=\"qrcode-li wechat\" ><img src=\"https:\/\/www.chenweikang.top\/wp-content\/uploads\/2019\/07\/wexin.png\" \/><\/div><div class=\"qrcode-li alipay\" style=\"display:none;\"><img src=\"https:\/\/www.chenweikang.top\/wp-content\/uploads\/2019\/07\/ali-pay.png\" \/><\/div><div class=\"qrcode-li hongbao\" style=\"display:none;\"><img src=\"https:\/\/www.chenweikang.top\/wp-content\/uploads\/2019\/07\/ali-hongbao.png\" \/><\/div><\/div>\r\n                <ul class=\"platform\"><li class=\"icon-wechat active\" data-bg-color=\"#05af4e\" data-thanks=\"~\u8c22\u8c22\u6253\u8d4f~\"><\/li><li class=\"icon-alipay \" data-bg-color=\"#00a2ea\" data-thanks=\"~\u8c22\u8c22\u6253\u8d4f~\"><\/li><li class=\"icon-hongbao \" data-bg-color=\"#dd5746\" data-thanks=\"<p>\u626b\u7801\u9886\u7ea2\u5305<\/p><p style='margin-top: 24px;'>\uff08\u4f59\u989d\u5b9d\u652f\u4ed8\u65f6\u53ef\u62b5\u73b0\uff09<\/p>\"><\/li><\/ul>\r\n            <\/div>\r\n            <a href=\"javascript:void(0);\" id=\"__youshang_btn\">\u8d4f<\/a>\r\n        <\/div>","protected":false},"excerpt":{"rendered":"<p>CentOS\u53d1\u5e037.0\u7248\u672c\uff0c\u65b0\u7248\u672c\u5e26\u6765\u5f88\u591a\u7279\u6027\uff0c\u9664\u4e86\u5185\u6838\u66f4\u65b0\u52303.10\u5916\uff0c\u652f\u6301 Linux \u5bb9\u5668\u3001Open V [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[19,5],"tags":[25],"class_list":["post-64","post","type-post","status-publish","format-standard","hentry","category-server","category-website","tag-lamp"],"_links":{"self":[{"href":"https:\/\/www.chenweikang.top\/index.php?rest_route=\/wp\/v2\/posts\/64","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chenweikang.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chenweikang.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chenweikang.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chenweikang.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=64"}],"version-history":[{"count":0,"href":"https:\/\/www.chenweikang.top\/index.php?rest_route=\/wp\/v2\/posts\/64\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.chenweikang.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=64"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chenweikang.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=64"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chenweikang.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=64"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}