{"id":294,"date":"2018-01-18T13:19:56","date_gmt":"2018-01-18T13:19:56","guid":{"rendered":"http:\/\/www.sunyuping.cn\/?p=294"},"modified":"2018-01-18T13:19:56","modified_gmt":"2018-01-18T13:19:56","slug":"centos6-5%e4%b8%8b%e7%9b%b4%e6%8e%a5%e4%bd%bf%e7%94%a8yum%e5%ae%8c%e7%be%8e%e6%90%ad%e5%bb%balnmp%e7%8e%af%e5%a2%83php5-6%ef%bc%8cmysql5-5%ef%bc%8cnginx1-10","status":"publish","type":"post","link":"https:\/\/www.sunyuping.com\/index.php\/2018\/01\/18\/centos6-5%e4%b8%8b%e7%9b%b4%e6%8e%a5%e4%bd%bf%e7%94%a8yum%e5%ae%8c%e7%be%8e%e6%90%ad%e5%bb%balnmp%e7%8e%af%e5%a2%83php5-6%ef%bc%8cmysql5-5%ef%bc%8cnginx1-10\/","title":{"rendered":"centos6.5\u4e0b\u76f4\u63a5\u4f7f\u7528yum\u5b8c\u7f8e\u642d\u5efaLNMP\u73af\u5883(php5.6\uff0cmysql5.5\uff0cnginx1.10)"},"content":{"rendered":"<p>\t\t\t\t\u4e00. \u5b89\u88c5nginx<br \/>\n#\u5b89\u88c5nginx<br \/>\nyum install -y nginx<br \/>\n#\u8bbe\u7f6enginx\u5f00\u673a\u542f\u52a8<br \/>\nchkconfig nginx on<br \/>\n#\u542f\u52a8nginx<br \/>\nservice nginx start<br \/>\n\u4e8c. \u5b89\u88c5PHP5.6<br \/>\n\u68c0\u67e5\u5f53\u524d\u5b89\u88c5\u7684PHP\u5305<br \/>\nyum list installed | grep php<br \/>\n\u5982\u679c\u6709\u5b89\u88c5\u7684PHP\u5305\uff0c\u5148\u5220\u9664\u4ed6\u4eec, \u5982:<br \/>\nyum remove php.x86_64 php-cli.x86_64 php-common.x86_64<br \/>\n\u914d\u7f6e\u5b89\u88c5\u5305\u6e90:<br \/>\n# Centos 5.X<br \/>\nrpm -Uvh http:\/\/mirror.webtatic.com\/yum\/el5\/latest.rpm<br \/>\n# CentOs 6.x<br \/>\nrpm -Uvh http:\/\/mirror.webtatic.com\/yum\/el6\/latest.rpm      =\u300b\u300b\u300b \u6709\u65f6\u5019\u4f1a\u4e0d\u6267\u884c\u6216\u62a5\u9519\uff0c\u591a\u6572\u51e0\u6b21\u4e00\u5b9a\u8981\u6240\u6709\u5b57\u6bcd\u90fd\u5bf9\u5e94\u4e0a<br \/>\n# CentOs 7.X<br \/>\nrpm -Uvh https:\/\/mirror.webtatic.com\/yum\/el7\/epel-release.rpm<br \/>\nrpm -Uvh https:\/\/mirror.webtatic.com\/yum\/el7\/webtatic-release.rpm<br \/>\n\u5982\u679c\u60f3\u5220\u9664\u4e0a\u9762\u5b89\u88c5\u7684\u5305\uff0c\u91cd\u65b0\u5b89\u88c5<br \/>\nrpm -qa | grep webstatic<br \/>\nrpm -e  [\u4e0a\u9762\u641c\u7d22\u5230\u7684\u5305\u5373\u53ef]<br \/>\n\u6267\u884c\u5b89\u88c5<br \/>\nyum -y install php56w.x86_64<br \/>\nyum -y &#8211;enablerepo=webtatic install php56w-devel<br \/>\nyum -y install php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64 php56w-opcache.x86_64<br \/>\n\u5b89\u88c5PHP FPM<br \/>\nyum -y install php56w-fpm<br \/>\n#\u8bbe\u7f6ephp-fpm\u5f00\u673a\u542f\u52a8<br \/>\nchkconfig php-fpm on<br \/>\n#\u542f\u52a8php-fpm<br \/>\n\/etc\/init.d\/php-fpm start<br \/>\n\u6ce8\uff1a\u5982\u679c\u60f3\u66f4\u6362\u5230php5.5\u62165.4\u7248\u672c, \u76f4\u63a5\u628a\u4e0a\u9762\u768456w\u6362\u621055w\u6216\u800554w\u5c31\u53ef\u4ee5\u4e86<br \/>\n\u4e09. \u5b89\u88c5 MySQL<br \/>\nyum install -y mysql mysql-server<br \/>\n#\u542f\u52a8MySQL<br \/>\n\/etc\/init.d\/mysqld start<br \/>\n#\u8bbe\u4e3a\u5f00\u673a\u542f\u52a8<br \/>\nchkconfig mysqld on<br \/>\n#\u62f7\u8d1d\u914d\u7f6e\u6587\u4ef6\uff08\u6ce8\u610f\uff1a\u5982\u679c\/etc\u76ee\u5f55\u4e0b\u9762\u9ed8\u8ba4\u6709\u4e00\u4e2amy.cnf\uff0c\u76f4\u63a5\u8986\u76d6\u5373\u53ef\uff09<br \/>\ncp \/usr\/share\/mysql\/my-medium.cnf \/etc\/my.cnf<br \/>\n\u4e3aroot\u8d26\u6237\u8bbe\u7f6e\u5bc6\u7801<br \/>\nmysql_secure_installation<br \/>\n# \u56de\u8f66\uff0c\u6839\u636e\u63d0\u793a\u8f93\u5165Y\uff0c\u8f93\u51652\u6b21\u5bc6\u7801\uff0c\u56de\u8f66\uff0c\u6839\u636e\u63d0\u793a\u8f93\u5165Y\u6216\u8005N\uff08\u6bd4\u5982\u4e0d\u5141\u8bb8\u8fdc\u7a0b\u8bbf\u95ee\uff1aN\uff09\uff0c\u6700\u540e\u51fa\u73b0\uff1aThanks for using MySQL!<br \/>\n#  MySql\u5bc6\u7801\u8bbe\u7f6e\u5b8c\u6210\uff0c\u91cd\u65b0\u542f\u52a8 MySQL\uff1a<br \/>\n#\u91cd\u542f<br \/>\n\/etc\/init.d\/mysqld restart<br \/>\n#\u505c\u6b62<br \/>\n\/etc\/init.d\/mysqld stop<br \/>\n#\u542f\u52a8<br \/>\n\/etc\/init.d\/mysqld start<br \/>\n\u914d\u7f6e<br \/>\n1. \u914d\u7f6enginx<br \/>\nvi \/etc\/nginx\/conf.d\/default.conf    \u4e0d\u8981\u6267\u884c\u8fd9\u4e00\u53e5\uff1arm -rf \/etc\/nginx\/conf.d\/*<br \/>\n\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9 :<\/p>\n<p>server{<br \/>\n    listen      80;<br \/>\n    server_name _;\u3000\u3000\/\/\u8fd9\u91cc\u586b\u5199\u4f60\u7684\u57df\u540d<br \/>\n    index index.php index.html index.htm;<br \/>\n    root  \/var\/www\/html;<\/p>\n<p>    location ~ .*\\.(php|php5)?$<br \/>\n    {<br \/>\n            #fastcgi_pass  unix:\/tmp\/php-cgi.sock;<br \/>\n            fastcgi_pass  127.0.0.1:9000;<br \/>\n            fastcgi_index index.php;<br \/>\n            include fastcgi.conf;\u3000\u3000<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\/\/\u5982\u679c\/etc\/nginx\/ \u4e0b\u6ca1\u6709fastcgi.conf,\u90a3\u4e48\u4e0a\u9762\u90a3\u4e00\u53e5(\u65b9\u6cd5\u4e00)\u5c31\u4e0d\u8981\uff0c\u53e6\u5916\u52a0\u4e0a\u4e0b\u9762\u4e24\u53e5,\u65b9\u6cd5\u4e8c\uff08\u9002\u5e94\u4e8e\u817e\u8baf\u4e916.5\uff09\uff1a<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000  \/\/fastcgi_param  SCRIPT_FILENAME  \/var\/www\/html$fastcgi_script_name;<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\/\/include fastcgi_params;<\/p>\n<p>    }<\/p>\n<p>    location \/ {<br \/>\n        try_files $uri $uri\/ \/index.php?$query_string;<br \/>\n    }<br \/>\n}<br \/>\n\u8bf4\u660e: \/var\/www\/html \u4e3aweb\u6839\u76ee\u5f55, \u3010location \/\u3011 &#8230; \u4e3aurl\u7684rewrite,\u9690\u85cf index.php<\/p>\n<p>2. \u914d\u7f6ephp-fpm<br \/>\nvi \/etc\/php-fpm.d\/www.conf<br \/>\n\u5c06\u7528\u6237\u548c\u7528\u6237\u7ec4\u8bbe\u7f6e\u4e3anginx, \u5982:<\/p>\n<p>#\u4fee\u6539\u7528\u6237\u4e3anginx<br \/>\nuser = nginx<br \/>\n #\u4fee\u6539\u7ec4\u4e3anginx<br \/>\ngroup = nginx<br \/>\n\u5f00\u59cb\u6d4b\u8bd5<br \/>\ncd \/var\/www<br \/>\nvi index.php<br \/>\n\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801<\/p>\n<p><?php\necho phpinfo();\n?><br \/>\n:wq! \u4fdd\u5b58\u9000\u51fa<\/p>\n<p>#\u8bbe\u7f6e\u6743\u9650<br \/>\nchown nginx.nginx \/var\/www -R<br \/>\n#\u91cd\u542fnginx<br \/>\nservice nginx restart<br \/>\n#\u91cd\u542fphp-fpm<br \/>\nservice php-fpm restart<br \/>\n\u5728\u5ba2\u6237\u7aef\u6d4f\u89c8\u5668\u8f93\u5165\u670d\u52a1\u5668IP\u5730\u5740(\u5982: 127.0.0.1)\uff0c\u53ef\u4ee5\u770b\u5230\u76f8\u5173\u7684\u914d\u7f6e\u4fe1\u606f\uff01<\/p>\n<p>\u5982\u679c\u662f\u865a\u62df\u673a\uff0c\u5219\u4f7f\u7528ifconfig\u83b7\u53d6\u865a\u62df\u673aip\uff0c\u5728\u6d4f\u89c8\u5668\u8f93\u5165\uff1a\u865a\u62df\u673aIP\/index.php\uff0c\u53ef\u4ee5\u770b\u5230\u76f8\u5173\u7684\u914d\u7f6e\u4fe1\u606f\uff01<br \/>\n\u8bf4\u660elnmp\u914d\u7f6e\u6210\u529f\uff01<br \/>\n\u6ce8\uff1amemcache\u6269\u5c55\u5b89\u88c5<br \/>\n    yum -y install php-pecl-memcache\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00. \u5b89\u88c5nginx #\u5b89\u88c5nginx yum install -y nginx #\u8bbe\u7f6enginx\u5f00\u673a\u542f\u52a8 c &#8230; <a title=\"centos6.5\u4e0b\u76f4\u63a5\u4f7f\u7528yum\u5b8c\u7f8e\u642d\u5efaLNMP\u73af\u5883(php5.6\uff0cmysql5.5\uff0cnginx1.10)\" class=\"read-more\" href=\"https:\/\/www.sunyuping.com\/index.php\/2018\/01\/18\/centos6-5%e4%b8%8b%e7%9b%b4%e6%8e%a5%e4%bd%bf%e7%94%a8yum%e5%ae%8c%e7%be%8e%e6%90%ad%e5%bb%balnmp%e7%8e%af%e5%a2%83php5-6%ef%bc%8cmysql5-5%ef%bc%8cnginx1-10\/\" aria-label=\"\u9605\u8bfb centos6.5\u4e0b\u76f4\u63a5\u4f7f\u7528yum\u5b8c\u7f8e\u642d\u5efaLNMP\u73af\u5883(php5.6\uff0cmysql5.5\uff0cnginx1.10)\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-294","post","type-post","status-publish","format-standard","hentry","category-7"],"_links":{"self":[{"href":"https:\/\/www.sunyuping.com\/index.php\/wp-json\/wp\/v2\/posts\/294","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sunyuping.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sunyuping.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sunyuping.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sunyuping.com\/index.php\/wp-json\/wp\/v2\/comments?post=294"}],"version-history":[{"count":0,"href":"https:\/\/www.sunyuping.com\/index.php\/wp-json\/wp\/v2\/posts\/294\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sunyuping.com\/index.php\/wp-json\/wp\/v2\/media?parent=294"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sunyuping.com\/index.php\/wp-json\/wp\/v2\/categories?post=294"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sunyuping.com\/index.php\/wp-json\/wp\/v2\/tags?post=294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}