{"id":733,"date":"2017-12-01T16:04:20","date_gmt":"2017-12-01T08:04:20","guid":{"rendered":"https:\/\/damogame.cn:15443\/wordpress\/?p=733"},"modified":"2019-04-11T16:18:42","modified_gmt":"2019-04-11T08:18:42","slug":"centos7%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%aeapachephpmysqlphpmyadmin","status":"publish","type":"post","link":"https:\/\/i007.cc\/wordpress\/archives\/733","title":{"rendered":"Centos7\u5b89\u88c5\u914d\u7f6eApache+PHP+Mysql+phpmyadmin\uff08\u672c\u673a\u5728\u7528\uff09"},"content":{"rendered":"<div class=\"article_bar clearfix\">\n<p><strong>\u4e00\u3001\u5b89\u88c5Apache<\/strong><\/p>\n<\/div>\n<div id=\"article_content\" class=\"article_content csdn-tracking-statistics\" data-mod=\"popu_519\" data-dsm=\"post\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">yum install httpd<\/pre>\n<p>&nbsp;<\/p>\n<p>\u5b89\u88c5\u6210\u529f\u540e\uff0cApache\u64cd\u4f5c\u547d\u4ee4\uff1a<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">systemctl start httpd      \/\/\u542f\u52a8apache\r\nsystemctl stop httpd       \/\/\u505c\u6b62apache\r\nsystemctl restart httpd    \/\/\u91cd\u542fapache\r\nsystemctl enable httpd     \/\/\u8bbe\u7f6eapache\u5f00\u673a\u542f\u52a8<\/pre>\n<p>&nbsp;<\/p>\n<p><em>\u5f02\u5e38\u5904\u7406<\/em><br \/>\n\u6211\u518d\u963f\u91cc\u4e91\u4e0a\u914d\u7f6e\u5e76\u51fa\u73b0\u542f\u52a8Apache\u540e\u65e0\u6cd5\u8bbf\u95ee\u7684\u95ee\u9898\uff0c\u4f46\u662f\u4e00\u822c\u670d\u52a1\u5668\u8bbf\u95eeApache\u53ef\u80fd\u9700\u8981\u5982\u4e0b\u64cd\u4f5c\uff1a<br \/>\n\uff081\uff09\u5728\u9632\u706b\u5899\u4e2d\u5f00\u653e80\u7aef\u53e3<br \/>\n\u73b0\u5728\u9700\u8981\u5c06 http \u670d\u52a1\u52a0\u5165\u9632\u706b\u5899\u4ee5\u5141\u8bb8\u5916\u90e8\u8bbf\u95ee\uff0c<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">firewall-cmd --add-service=http --permanent<\/pre>\n<p>&nbsp;<\/p>\n<p>\u2013permanent \u53c2\u6570\u8868\u793a\u8fd9\u662f\u4e00\u6761\u6c38\u4e45\u9632\u706b\u5899\u89c4\u5219\uff0c\u5982\u679c\u4e0d\u52a0\u5219\u91cd\u542f\u7cfb\u7edf\u540e\u5c31\u6ca1\u6709\u8fd9\u6761\u89c4\u5219\u4e86\u3002<\/p>\n<p>\u800c\u5bf9\u4e8e\u81ea\u5b9a\u4e49\u7684\u7aef\u53e3\uff08\u598281\uff09\uff0c\u4e5f\u9700\u8981\u6dfb\u52a0\u9632\u706b\u5899\u89c4\u5219\uff0c<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">firewall-cmd --zone=public --add-port=81\/tcp --permanent<\/pre>\n<p>&nbsp;<\/p>\n<p>\u91cd\u542f Firewalld \u4f7f\u8be5\u89c4\u5219\u751f\u6548\uff0c<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">systemctl restart firewalld<\/pre>\n<p>&nbsp;<\/p>\n<p>\uff082\uff09\u5173\u95edSELINUX<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">vi \/etc\/selinux\/config<\/pre>\n<p>&nbsp;<\/p>\n<p>\u6ce8\u91ca\u6389\u5982\u4e0b\u4e24\u53e5\uff0c\u6dfb\u52a0\u6700\u540e\u4e00\u9879<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">\\#SELINUX=enforcing #\u6ce8\u91ca\u6389\r\n\\#SELINUXTYPE=targeted #\u6ce8\u91ca\u6389\r\nSELINUX=disabled #\u589e\u52a0<\/pre>\n<p>&nbsp;<\/p>\n<p><code>:wq!<\/code>\u00a0\u4fdd\u5b58\u9000\u51fa<\/p>\n<p>\u8f93\u5165\u5982\u4e0b\u547d\u4ee4<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">setenforce 0 #\u4f7f\u914d\u7f6e\u7acb\u5373\u751f\u6548<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>\u4e8c\u3001 \u5b89\u88c5MariaDB (MySQL\u7684\u4e00\u4e2a\u5f00\u6e90\u5206\u652f)<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">yum install mariadb mariadb-server<\/pre>\n<p>&nbsp;<\/p>\n<p>MariaDB\u5b89\u88c5\u6210\u529f\u540e\uff0c\u9700\u8981\u914d\u7f6eMySQL\u7684root\u5bc6\u7801\uff0c\u6b64\u5916\uff0c\u5907\u6ce8\u4e00\u4e0b\u542f\u52a8\u5173\u95edMariaDB\u7684\u5e38\u7528\u547d\u4ee4<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">systemctl start mariadb     \/\/\u542f\u52a8MariaDB\r\nsystemctl stop mariadb      \/\/\u505c\u6b62MariaDB\r\nsystemctl restart mariadb   \/\/\u91cd\u542fMariaDB\r\nsystemctl enable mariadb    \/\/\u8bbe\u7f6e\u5f00\u673a\u542f\u52a8<\/pre>\n<p>&nbsp;<\/p>\n<p>\u8bbe\u7f6eroot\u8d26\u6237\u5bc6\u7801<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">mysql_secure_installation<\/pre>\n<p>&nbsp;<\/p>\n<p>Enter current password for root (enter for none):<br \/>\nSet root password? [Y\/n]<\/p>\n<p>\u70b9\u51fb\u56de\u8f66\u7136\u540e\u63d0\u793a\u662f\u5426\u8bbe\u7f6eroot\u8d26\u53f7\u5bc6\u7801\uff0c\u8f93\u5165y<\/p>\n<p>New password:<br \/>\nRe-enter new password:<br \/>\nPassword updated successfully!<\/p>\n<p>\u63d0\u793a\u8f93\u5165\u65b0\u5bc6\u7801\u548c\u91cd\u590d\u8f93\u5165\u65b0\u5bc6\u7801\uff0c\u91cd\u590d\u8f93\u5165\u4e24\u6b21\u540e\uff0c\u51fa\u73b0\u66f4\u65b0\u5bc6\u7801\u6210\u529f\u63d0\u793a\u3002<\/p>\n<p>\u7136\u540e\u4e00\u8def\u8f93\u5165y\u5c31\u53ef\u4ee5\u3002<\/p>\n<p>Remove anonymous users? [Y\/n] y<br \/>\n&#8230; Success!<\/p>\n<p>Disallow root login remotely? [Y\/n] y<br \/>\n&#8230; Success!<\/p>\n<p>Remove test database and access to it? [Y\/n] y<br \/>\n&#8211; Dropping test database&#8230;<br \/>\n&#8230; Success!<br \/>\n&#8211; Removing privileges on test database&#8230;<br \/>\n&#8230; Success!<\/p>\n<p>Reload privilege tables now? [Y\/n] y<br \/>\n&#8230; Success!<\/p>\n<p>Thanks for using MariaDB!<\/p>\n<p>\u8bbe\u7f6eroot\u5bc6\u7801\u540e\uff0c\u91cd\u542fMariaDB\u751f\u6548<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">systemctl restart mariadb.service<\/pre>\n<p>&nbsp;<\/p>\n<p>\u6d4b\u8bd5\u8bbf\u95ee\u6570\u636e\u5e93\uff1a<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">mysql -uroot -p<\/pre>\n<p>&nbsp;<\/p>\n<p>\u7136\u540e\u8f93\u5165\u5bc6\u7801,\u767b\u5f55\u6210\u529f\u540e\u663e\u793a\u5982\u4e0b\uff1a<\/p>\n<p>Enter password:<br \/>\nWelcome to the MariaDB monitor. Commands end with ; or \\g.<br \/>\nYour MariaDB connection id is 2<br \/>\nServer version: 5.5.44-MariaDB MariaDB Server<\/p>\n<p>Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.<\/p>\n<p>Type &#8216;help;&#8217; or &#8216;\\h&#8217; for help. Type &#8216;\\c&#8217; to clear the current input statement.<\/p>\n<p>MariaDB [(none)]&gt;<\/p>\n<p>\u8f93\u5165\u5982\u4e0b\u547d\u4ee4\uff0c\u67e5\u770b\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u6570\u636e\u5e93<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">show databases;<\/pre>\n<p>&nbsp;<\/p>\n<p>\u9000\u51fa\u547d\u4ee4\uff1a<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">exit;<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>\u4e09\u3001\u5b89\u88c5PHP\u4ee5\u53caPHP\u62d3\u5c55<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">yum install php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash<\/pre>\n<p>&nbsp;<\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u91cd\u542fApache\u670d\u52a1\u5668<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">systemctl restart httpd.service<\/pre>\n<p>&nbsp;<\/p>\n<p>\u6d4b\u8bd5PHP\u5b89\u88c5\u7ed3\u679c<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">vi \/var\/www\/html\/index.php<\/pre>\n<p>&nbsp;<\/p>\n<p>\u8f93\u5165\u5982\u4e0b\u5185\u5bb9<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;?php\r\n  phpinfo();\r\n?&gt;<\/pre>\n<p>&nbsp;<\/p>\n<p>\u8f93\u5165<code>:wq!<\/code>\u00a0\u4fdd\u5b58\u9000\u51fa<br \/>\n\u5728\u6d4f\u89c8\u5668\u4e2d\u8f93\u5165\u670d\u52a1\u5668\u5730\u5740\uff0c\u67e5\u770b\u662f\u5426\u53ef\u4ee5\u770b\u5230\uff1a<\/p>\n<div class=\"image-package imagebubble\">\n<p><img decoding=\"async\" class=\"imagebubble-image\" src=\"http:\/\/upload-images.jianshu.io\/upload_images\/1281379-56e0a90c09aeb82e.png?imageMogr2\/auto-orient\/strip%7CimageView2\/2\/w\/1240\" alt=\"\" \/><\/p>\n<div class=\"image-caption\">\u9875\u9762\u6548\u679c<\/div>\n<\/div>\n<p><strong>\u56db\u3001\u5b89\u88c5phpmyadmin<\/strong><\/p>\n<p>\u4f7f\u7528yum\u5b89\u88c5phpmyadmin<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">yum install phpmyadmin php-mcrypt<\/pre>\n<p>&nbsp;<\/p>\n<p>phpMyAdmin \u7684\u9ed8\u8ba4\u5b89\u88c5\u76ee\u5f55\u662f \/usr\/share\/phpMyAdmin\uff0c\u540c\u65f6\u4f1a\u5728 Apache \u7684\u914d\u7f6e\u6587\u4ef6\u76ee\u5f55\u4e2d\u81ea\u52a8\u521b\u5efa\u865a\u62df\u4e3b\u673a\u914d\u7f6e\u6587\u4ef6 \/etc\/httpd\/conf.d\/phpMyAdmin.conf\uff08\u533a\u5206\u5927\u5c0f\u5199\uff09\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cCentOS 7\u4e0a\u7684phpMyAdmin\u53ea\u5141\u8bb8\u4ece\u56de\u73af\u5730\u5740(127.0.0.1)\u8bbf\u95ee\u3002\u4e3a\u4e86\u80fd\u8fdc\u7a0b\u8fde\u63a5\uff0c\u4f60\u9700\u8981\u6539\u52a8\u5b83\u7684\u914d\u7f6e\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">vi \/etc\/httpd\/conf.d\/phpMyAdmin.conf<\/pre>\n<p>&nbsp;<\/p>\n<p>\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\uff0c\u5982\u4e0b\uff1a<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"># phpMyAdmin - Web based MySQL browser written in php\r\n# \r\n# Allows only localhost by default\r\n#\r\n# But allowing phpMyAdmin to anyone other than localhost should be considered\r\n# dangerous unless properly secured by SSL\r\n\r\nAlias \/phpMyAdmin \/usr\/share\/phpMyAdmin\r\nAlias \/phpmyadmin \/usr\/share\/phpMyAdmin\r\n\r\n&lt;Directory \/usr\/share\/phpMyAdmin\/&gt;\r\n   AddDefaultCharset UTF-8\r\n\r\n   &lt;IfModule mod_authz_core.c&gt;\r\n     # Apache 2.4\r\n     &lt;RequireAny&gt;\r\n       # Require ip 127.0.0.1\r\n       # Require ip ::1\r\n        Require all granted\r\n     &lt;\/RequireAny&gt;\r\n   &lt;\/IfModule&gt;\r\n   &lt;IfModule !mod_authz_core.c&gt;\r\n     # Apache 2.2\r\n     Order Deny,Allow\r\n     Deny from All\r\n     Allow from 127.0.0.1\r\n     Allow from ::1\r\n   &lt;\/IfModule&gt;\r\n&lt;\/Directory&gt;\r\n\r\n&lt;Directory \/usr\/share\/phpMyAdmin\/setup\/&gt;\r\n   &lt;IfModule mod_authz_core.c&gt;\r\n     # Apache 2.4\r\n     &lt;RequireAny&gt;\r\n       # Require ip 127.0.0.1\r\n       # Require ip ::1\r\n        Require all granted\r\n     &lt;\/RequireAny&gt;\r\n   &lt;\/IfModule&gt;\r\n   &lt;IfModule !mod_authz_core.c&gt;\r\n     # Apache 2.2\r\n     Order Deny,Allow\r\n     Deny from All\r\n     Allow from 127.0.0.1\r\n     Allow from ::1\r\n   &lt;\/IfModule&gt;\r\n&lt;\/Directory&gt;\r\n\r\n# These directories do not require access over HTTP - taken from the original\r\n# phpMyAdmin upstream tarball\r\n#\r\n&lt;Directory \/usr\/share\/phpMyAdmin\/libraries\/&gt;\r\n    Order Deny,Allow\r\n    Deny from All\r\n    Allow from None\r\n&lt;\/Directory&gt;\r\n\r\n&lt;Directory \/usr\/share\/phpMyAdmin\/setup\/lib\/&gt;\r\n    Order Deny,Allow\r\n    Deny from All\r\n    Allow from None\r\n&lt;\/Directory&gt;\r\n\r\n&lt;Directory \/usr\/share\/phpMyAdmin\/setup\/frames\/&gt;\r\n    Order Deny,Allow\r\n    Deny from All\r\n    Allow from None\r\n&lt;\/Directory&gt;\r\n\r\n# This configuration prevents mod_security at phpMyAdmin directories from\r\n# filtering SQL etc.  This may break your mod_security implementation.\r\n#\r\n#&lt;IfModule mod_security.c&gt;\r\n#    &lt;Directory \/usr\/share\/phpMyAdmin\/&gt;\r\n#        SecRuleInheritance Off\r\n#    &lt;\/Directory&gt;\r\n#&lt;\/IfModule&gt;\r\n<\/pre>\n<pre class=\"hljs xml\"><code class=\"xml\"><\/code><\/pre>\n<p>\u7136\u540e\u91cd\u542fApache\u670d\u52a1\u5668<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">systemctl restart httpd<\/pre>\n<p>&nbsp;<\/p>\n<p>\u7136\u540e\u5c31\u53ef\u4ee5\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95ee<a href=\"http:\/\/xn--ip-fr5c86lw2a0cw16k\/phpmyadmin%E8%AE%BF%E9%97%AE\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/\u670d\u52a1\u5668ip\u5730\u5740\/phpmyadmin\u8bbf\u95ee<\/a><\/p>\n<div class=\"image-package imagebubble\">\n<p><img decoding=\"async\" class=\"imagebubble-image\" src=\"http:\/\/upload-images.jianshu.io\/upload_images\/1281379-7f7d8dfc590cdbba.png?imageMogr2\/auto-orient\/strip%7CimageView2\/2\/w\/1240\" alt=\"\" \/><\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u5b89\u88c5Apache yum insta<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[],"tags":[117],"class_list":["post-733","post","type-post","status-publish","format-standard","hentry","tag-01-linux"],"_links":{"self":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/733","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/comments?post=733"}],"version-history":[{"count":0,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/733\/revisions"}],"wp:attachment":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/media?parent=733"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/categories?post=733"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/tags?post=733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}