{"id":1663,"date":"2013-08-04T22:31:47","date_gmt":"2013-08-04T14:31:47","guid":{"rendered":"http:\/\/www.huzs.top\/?p=1663"},"modified":"2013-08-04T22:31:48","modified_gmt":"2013-08-04T14:31:48","slug":"debian-7-%e5%ae%89%e8%a3%85lnmp%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.huzs.top\/?p=1663","title":{"rendered":"Debian 7 \u5b89\u88c5LNMP\u670d\u52a1\u5668"},"content":{"rendered":"<h2>1\uff0c\u5b89\u88c5MySQL<\/h2>\n<p>\u6267\u884c\u547d\u4ee4\uff1a<\/p>\n<blockquote><p>apt-get install -y mysql-server mysql-client<\/p><\/blockquote>\n<p>\u5373\u53ef\u5b89\u88c5MySQL\uff0c\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u4f1a\u8be2\u95ee root\u5bc6\u7801 \uff0c\u952e\u5165\u4f60\u9700\u8981\u7684\u5bc6\u7801\u4e4b\u540e\u56de\u8f66\u5373\u53ef\u3002<\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6267\u884c\u5982\u4e0b\u547d\u4ee4\u8fdb\u884c\u4e00\u6b65\u5b89\u5168\u8bbe\u7f6e\uff1a<\/p>\n<blockquote><p>mysql_secure_installation<\/p><\/blockquote>\n<p>\u6309\u7167\u63d0\u793a\u8fdb\u884c\uff0c\u8fc7\u7a0b\u4e2d\u4f1a\u8be2\u95ee\u662f\u5426\u66f4\u6539 root\u5bc6\u7801\uff0c\u662f\u5426\u79fb\u9664\u533f\u540d\u7528\u6237\uff0c\u662f\u5426\u7981\u6b62root\u8fdc\u7a0b\u767b\u5f55\u7b49\u3002<!--more--><\/p>\n<h2>2\uff0c\u5b89\u88c5PHP<\/h2>\n<p>\u6267\u884c\u547d\u4ee4\uff1a<\/p>\n<blockquote><p>apt-get install php5-fpm php5-gd php5-mysql php5-memcache php5-curl<\/p><\/blockquote>\n<p>\u4e0a\u9762\u7684\u547d\u4ee4\u5b89\u88c5\u4e86php5-memcache\u7684\u6269\u5c55\uff0c\u4e8e\u662f\u7ee7\u7eed\u5b89\u88c5 Memcached \u3002<\/p>\n<blockquote><p>apt-get install memcached<\/p><\/blockquote>\n<p>\u5b89\u88c5\u5b8c\u6bd5\u4e4b\u540e\uff0c\u4f7f\u7528 php5-fpm -v \u67e5\u770b\u4e00\u4e0bPHP\u7684\u7248\u672c\uff1a<\/p>\n<figure><\/p>\n<table><\/p>\n<tbody><\/p>\n<tr><\/p>\n<td><\/p>\n<pre>root@ztbox:~# php5-fpm -v<br>PHP 5.4.16-1~dotdeb.1 (fpm-fcgi) (built: Jun  8 2013 22:20:42)<br>Copyright (c) 1997-2013 The PHP Group<br>Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies<\/pre>\n<p><\/td>\n<p><\/tr>\n<p><\/tbody>\n<p><\/table>\n<p><\/figure>\n<p><\/p>\n<h2>3\uff0c\u5b89\u88c5Nginx<\/h2>\n<p>\u5173\u4e8eNginx\uff0c\u62fe\u4eba\u7259\u6167\u4e00\u4e0b\uff1a<\/p>\n<p>Nginx (&#8220;engine x&#8221;) \u662f\u4e00\u4e2a\u9ad8\u6027\u80fd\u7684 HTTP \u548c\u53cd\u5411\u4ee3\u7406\u670d\u52a1\u5668\uff0c\u4e5f\u662f\u4e00\u4e2a IMAP\/POP3\/SMTP \u4ee3\u7406\u670d\u52a1\u5668\u3002 Nginx \u662f\u7531 Igor Sysoev \u4e3a\u4fc4\u7f57\u65af\u8bbf\u95ee\u91cf\u7b2c\u4e8c\u7684 Rambler.ru \u7ad9\u70b9\u5f00\u53d1\u7684\uff0c\u5b83\u5df2\u7ecf\u5728\u8be5\u7ad9\u70b9\u8fd0\u884c\u8d85\u8fc7\u4e09\u5e74\u4e86\u3002 Igor \u5c06\u6e90\u4ee3\u7801\u4ee5\u7c7bBSD\u8bb8\u53ef\u8bc1\u7684\u5f62\u5f0f\u53d1\u5e03\u3002<\/p>\n<p>Nginx \u8d85\u8d8a Apache \u7684\u9ad8\u6027\u80fd\u548c\u7a33\u5b9a\u6027\uff0c\u4f7f\u5f97\u56fd\u5185\u4f7f\u7528 Nginx \u4f5c\u4e3a Web \u670d\u52a1\u5668\u7684\u7f51\u7ad9\u4e5f\u8d8a\u6765\u8d8a\u591a\uff0c \u5176\u4e2d\u5305\u62ec\u65b0\u6d6a\u535a\u5ba2\u3001\u65b0\u6d6a\u64ad\u5ba2\u3001\u7f51\u6613\u65b0\u95fb\u3001\u817e\u8baf\u7f51\u3001\u641c\u72d0\u535a\u5ba2\u7b49\u95e8\u6237\u7f51\u7ad9\u9891\u9053\uff0c\u516d\u95f4\u623f\u300156.com\u7b49\u89c6\u9891\u5206\u4eab\u7f51\u7ad9\uff0cDiscuz!\u5b98\u65b9\u8bba\u575b\u3001\u6c34\u6728\u793e\u533a\u7b49\u77e5\u540d\u8bba\u575b\uff0c \u76db\u5927\u5728\u7ebf\u3001\u91d1\u5c71\u900d\u9065\u7f51\u7b49\u7f51\u7edc\u6e38\u620f\u7f51\u7ad9\uff0c\u8c46\u74e3\u3001\u4eba\u4eba\u7f51\u3001YUPOO\u76f8\u518c\u3001\u91d1\u5c71\u7231\u8bcd\u9738\u3001\u8fc5\u96f7\u5728\u7ebf\u7b49\u65b0\u5174Web 2.0\u7f51\u7ad9\u3002<\/p>\n<p>\u8fd9\u91cc\u6211\u76f4\u63a5\u5b89\u88c5\u4e86Nginx\u7684\u5168\u90e8\u6269\u5c55\u529f\u80fd\uff08nginx-full)\uff0c\u4ee5\u5e94\u5bf9\u4ee5\u540e\u53ef\u80fd\u51fa\u73b0\u7684\u529f\u80fd\u6027\u589e\u5f3a\u3002<\/p>\n<blockquote><p>apt-get install -y nginx-full<\/p><\/blockquote>\n<p>\u7136\u540e\u542f\u52a8Nginx:<\/p>\n<blockquote><p>service nginx start<\/p><\/blockquote>\n<p><img decoding=\"async\" alt=\"welcome to nginx\" src=\"\" \/><\/p>\n<p>\u8bbf\u95ee\u7ed3\u679c\u5982\u4e0a\u56fe\uff0c\u63a5\u4e0b\u6765\u914d\u7f6eNginx\u3002<\/p>\n<blockquote><p>vim \/etc\/nginx\/sites-available\/default<\/p><\/blockquote>\n<p><\/p>\n<figure><\/p>\n<table><\/p>\n<tbody><\/p>\n<tr><\/p>\n<td><\/p>\n<pre>\u2026\u2026<br>    location ~ \\.php$ {<br>        fastcgi_split_path_info ^(.+\\.php)(\/.+)$;<br>    #    # NOTE: You should have \"cgi.fix_pathinfo = 0;\" in php.ini<br>    #<br>    #    # With php5-cgi alone:<br>    #   fastcgi_pass 127.0.0.1:9000;<br>    #    # With php5-fpm:<br>        fastcgi_pass unix:\/var\/run\/php5-fpm.sock;<br>        fastcgi_index index.php;<br>        include fastcgi_params;<br>    }<br>\u2026\u2026<\/pre>\n<p><\/td>\n<p><\/tr>\n<p><\/tbody>\n<p><\/table>\n<p><\/figure>\n<p>\u4fee\u6539\u4fdd\u5b58\u4e4b\u540e\u91cd\u542fNginx\uff1a<\/p>\n<blockquote><p>service nginx restart<\/p><\/blockquote>\n<p>\u63a5\u4e0b\u6765\u6211\u4eec\u65b0\u5efa\u4e00\u4e2aphpinfo\uff0c\u67e5\u770bphp\u7684\u8be6\u7ec6\u4fe1\u606f\uff1a<\/p>\n<blockquote><p>vim \/usr\/share\/nginx\/html\/phpinfo.php<\/p><\/blockquote>\n<p><\/p>\n<figure><\/p>\n<table><\/p>\n<tbody><\/p>\n<tr><\/p>\n<td><\/p>\n<pre>&lt;?php phpinfo(); ?&gt;<\/pre>\n<p><\/td>\n<p><\/tr>\n<p><\/tbody>\n<p><\/table>\n<p><\/figure>\n<p>\u4fdd\u5b58\u4e4b\u540e\u8bbf\u95ee <a href=\"http:\/\/ip\/phpinfo.php\">http:\/\/ip\/phpinfo.php<\/a> , \u5982\u679c\u51fa\u73b0 phpinfo \u9875\u9762\uff0c\u5219\u5927\u529f\u544a\u6210\u3002<\/p>\n<h2>\u5982\u4f55\u65b0\u5efa\u7ad9\u70b9<\/h2>\n<p>\u548c\u519b\u54e5\u7684\u4e00\u952e\u5305\u4e0d\u540c\uff0c\u6b64\u65b9\u6cd5\u6240\u5b89\u88c5\u7684 LNMP \u9700\u8981\u624b\u52a8\u6dfb\u52a0\u7ad9\u70b9\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<pre>cd \/etc\/nginx\/conf.d<\/pre>\n<p> \u8fdb\u5165\u914d\u7f6e\u6587\u4ef6\u76ee\u5f55\uff0c\u65b0\u5efa\u4e00\u4e2a\u7ad9\u70b9\u914d\u7f6e\u6587\u4ef6\uff0c\u6bd4\u5982 <\/p>\n<pre>vi dearroy.com.conf<\/pre>\n<p>\uff0c<\/p>\n<figure><\/p>\n<table><\/p>\n<tbody><\/p>\n<tr><\/p>\n<td><\/p>\n<pre>server {<br>    listen 80;<br><br>\t#ipv6<br>    #listen [::]:80 default_server;<br><br>    root \/usr\/share\/nginx\/html\/dearroy.com;<br><br>\t#\u9ed8\u8ba4\u9996\u9875\u6587\u4ef6\u540d<br>    index index.php index.html index.htm;<br><br>\t#\u7ed1\u5b9a\u57df\u540d<br>    server_name localhost;<br><br>\t#\u4f2a\u9759\u6001\u89c4\u5219<br>\tinclude wordpress.conf;<br><br>    location \/ {<br>        try_files $uri $uri\/ \/index.html;        <br>    }<br>\t#\u5b9a\u4e49\u9519\u8bef\u9875\u9762<br>    #error_page 404 \/404.html;  <br><br>    location ~ \\.php$ {<br>        fastcgi_split_path_info ^(.+\\.php)(\/.+)$;<br>        fastcgi_pass 127.0.0.1:9000;<br>         fastcgi_index index.php;<br>         include fastcgi_params;<br>     }<br>     #PHP<br>}<\/pre>\n<p><\/td>\n<p><\/tr>\n<p><\/tbody>\n<p><\/table>\n<p><\/figure>\n<p>\u4fdd\u5b58\u4e4b\u540e\u91cd\u542fNginx\uff0c\u6dfb\u52a0\u53ca\u7ed1\u5b9a\u7f51\u7ad9\u5373\u5b8c\u6210\u3002<\/p>\n<p>\u6700\u540e\uff0c\u9644\u4e24\u4e2a\u6700\u5e38\u7528\u7684\u7a0b\u5e8fNginx\u4f2a\u9759\u6001\uff1a<\/p>\n<p>WordPress:<\/p>\n<figure><\/p>\n<table><\/p>\n<tbody><\/p>\n<tr><\/p>\n<td><\/p>\n<pre>location \/ {<br>if (-f $request_filename\/index.html){<br>                rewrite (.*) $1\/index.html break;<br>        }<br>if (-f $request_filename\/index.php){<br>                rewrite (.*) $1\/index.php;<br>        }<br>if (!-f $request_filename){<br>                rewrite (.*) \/index.php;<br>        }<br>}<\/pre>\n<p><\/td>\n<p><\/tr>\n<p><\/tbody>\n<p><\/table>\n<p><\/figure>\n<p>Discuz X:<\/p>\n<pre>rewrite ^([^\\.]*)\/topic-(.+)\\.html$ $1\/portal.php?mod=topic&amp;topic=$2 last;<br>rewrite ^([^\\.]*)\/article-([0-9]+)-([0-9]+)\\.html$ $1\/portal.php?mod=view&amp;aid=$2&amp;page=$3 last;<br>rewrite ^([^\\.]*)\/forum-(\\w+)-([0-9]+)\\.html$ $1\/forum.php?mod=forumdisplay&amp;fid=$2&amp;page=$3 last;<br>rewrite ^([^\\.]*)\/thread-([0-9]+)-([0-9]+)-([0-9]+)\\.html$ $1\/forum.php?mod=viewthread&amp;tid=$2&amp;extra=page%3D$4&amp;page=$3 last;<br>rewrite ^([^\\.]*)\/group-([0-9]+)-([0-9]+)\\.html$ $1\/forum.php?mod=group&amp;fid=$2&amp;page=$3 last;<br>rewrite ^([^\\.]*)\/space-(username|uid)-(.+)\\.html$ $1\/home.php?mod=space&amp;$2=$3 last;<br>rewrite ^([^\\.]*)\/([a-z]+)-(.+)\\.html$ $1\/$2.php?rewrite=$3 last;<br>if (!-e $request_filename) {<br>        return 404;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1\uff0c\u5b89\u88c5MySQL \u6267\u884c\u547d\u4ee4\uff1a apt-get install -y mysql-server mysql-c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1663","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.huzs.top\/index.php?rest_route=\/wp\/v2\/posts\/1663","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.huzs.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.huzs.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.huzs.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.huzs.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1663"}],"version-history":[{"count":0,"href":"https:\/\/www.huzs.top\/index.php?rest_route=\/wp\/v2\/posts\/1663\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.huzs.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1663"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.huzs.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1663"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.huzs.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1663"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}