{"id":6069,"date":"2018-09-11T07:59:37","date_gmt":"2018-09-10T23:59:37","guid":{"rendered":"http:\/\/4563.org\/?p=6069"},"modified":"2018-09-26T09:52:58","modified_gmt":"2018-09-26T01:52:58","slug":"centos-rhel-7-1-6-7%e4%b8%8b%e5%ae%89%e8%a3%85php-7-nginx-mysql-5-6","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=6069","title":{"rendered":"CentOS\/RHEL 7.1 &#038; 6.7\u4e0b\u5b89\u88c5PHP 7, NGINX &#038; MySQL 5.6"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>\u5efa\u8baeCentOS 7.\u5747\u4e3aSSH\u4e0b\u3001root\u7528\u6237\u3002<\/p>\n<p><strong>\u4e00\u3001\u5347\u7ea7\u7cfb\u7edf\uff0c\u66f4\u6362\u66f4\u65b0\u6e90<\/strong><br \/>\n\u9002\u7528\u4e8eCentOS \/ RHEL 7\u7cfb\u7edf<\/p>\n<pre><code>yum install epel-release\r\nrpm -Uvh http:\/\/rpms.famillecollet.com\/enterprise\/remi-release-7.rpm\r\nrpm -Uvh https:\/\/mirror.webtatic.com\/yum\/el7\/webtatic-release.rpm\r\nrpm -Uvh http:\/\/repo.mysql.com\/mysql-community-release-el7-5.noarch.rpm\r\n<\/code><\/pre>\n<p>\u9002\u7528\u4e8eCentOS \/ RHEL 6\u7cfb\u7edf<\/p>\n<pre><code>yum install epel-release\r\nrpm -Uvh http:\/\/rpms.famillecollet.com\/enterprise\/remi-release-6.rpm\r\nrpm -Uvh https:\/\/mirror.webtatic.com\/yum\/el6\/latest.rpm\r\nrpm -Uvh http:\/\/repo.mysql.com\/mysql-community-release-el6-5.noarch.rpm\r\n<\/code><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-6745\" src=\"https:\/\/4563.org\/wp-content\/uploads\/2018\/09\/20180926_015251.png\" alt=\"\" width=\"500\" height=\"263\" \/><\/p>\n<p><strong>\u4e8c\u3001\u5b89\u88c5PHP 7<\/strong><br \/>\n1\u3001\u5b89\u88c5PHP 7<\/p>\n<pre><code>yum install php70w\r\n<\/code><\/pre>\n<p>2\u3001\u5b89\u88c5PHP 7\u7ec4\u4ef6<br \/>\n\u67e5\u627e\u7ec4\u4ef6<\/p>\n<pre><code>yum search php70w\r\n<\/code><\/pre>\n<p>\u5b89\u88c5\u7ec4\u4ef6<\/p>\n<pre><code>yum install php70w-mysql php70w-xml php70w-soap php70w-xmlrpc\r\nyum install php70w-mbstring php70w-json php70w-gd php70w-mcrypt\r\n<\/code><\/pre>\n<p><strong>\u4e09\u3001\u5b89\u88c5NGINX<\/strong><br \/>\n1\u3001\u5b89\u88c5NGINX<\/p>\n<pre><code>yum install nginx\r\n<\/code><\/pre>\n<p>2\u3001\u542f\u52a8NGINX<\/p>\n<pre><code>systemctl enable nginx.service\r\nsystemctl start nginx.service\r\n<\/code><\/pre>\n<p><strong>\u56db\u3001\u5b89\u88c5MySQL 5.6<\/strong><br \/>\n1\u3001\u5b89\u88c5MySQL<\/p>\n<pre><code>yum install mysql-server\r\n<\/code><\/pre>\n<p>2\u3001\u5b89\u5168\u8bbe\u7f6e<\/p>\n<pre><code>systemctl start mysqld.service\r\nmysql_secure_installation\r\n<\/code><\/pre>\n<p>3\u3001\u542f\u52a8MySQL<\/p>\n<pre><code>systemctl restart mysqld.service\r\nsystemctl enable mysqld.service\r\n<\/code><\/pre>\n<p><strong>\u4e94\u3001\u8bbe\u7f6ePHP-FPM<\/strong><\/p>\n<pre><code>yum install php70w-fpm\r\n<\/code><\/pre>\n<p><strong>\u516d\u3001\u521b\u5efa\u7f51\u7ad9<\/strong><\/p>\n<pre><code>nano \/etc\/nginx\/conf.d\/example.conf\r\n<\/code><\/pre>\n<p>\u7c98\u8d34\u5982\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre><code>server {\r\n        listen   80;\r\n\r\n        root \/var\/www;\r\n        index index.php index.html index.htm;\r\n        server_name  example.com www.example.com;\r\n\r\n        location \/ {\r\n                try_files $uri $uri\/ \/index.html;\r\n        }\r\n\r\n        error_page 404 \/404.html;\r\n        error_page 500 502 503 504 \/50x.html;\r\n        location = \/50x.html {\r\n              root \/usr\/share\/nginx\/www;\r\n        }\r\n\r\n        location ~ .php$ {\r\n                try_files $uri =404;\r\n                fastcgi_pass 127.0.0.1:9000;\r\n                fastcgi_index index.php;\r\n                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\r\n                include fastcgi_params;\r\n        }\r\n}\r\n<\/code><\/pre>\n<p>\u6839\u636e\u9700\u8981\u66f4\u6539\u4e3a\u81ea\u5df1\u7684\u57df\u540d\u3001\u6587\u4ef6\u5b58\u653e\u76ee\u5f55\u3002<\/p>\n<p>\u4e03\u3001\u91cd\u542f\u670d\u52a1<\/p>\n<pre><code>systemctl restart nginx.service\r\nsystemctl restart php-fpm.service\r\n<\/code><\/pre>\n<p>\u516b\u3001\u9632\u706b\u5899\u5f00\u653ehttp (80) \u548c https (443)\u7aef\u53e3<\/p>\n<pre><code>firewall-cmd --permanent --zone=public --add-service=http\r\nfirewall-cmd --permanent --zone=public --add-service=https\r\nfirewall-cmd --reload\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; \u5efa\u8baeCentOS 7&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\/6069"}],"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=6069"}],"version-history":[{"count":3,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/6069\/revisions"}],"predecessor-version":[{"id":6746,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/6069\/revisions\/6746"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6069"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6069"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6069"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}