{"id":351,"date":"2013-07-06T13:16:01","date_gmt":"2013-07-06T05:16:01","guid":{"rendered":"http:\/\/www.shuran.cn\/?p=351"},"modified":"2013-09-24T09:30:24","modified_gmt":"2013-09-24T01:30:24","slug":"centos-6-4-x86_64-minimal-%e6%9c%80%e5%b0%8f%e5%ae%89%e8%a3%85%e4%b8%8b%ef%bc%8clnmp%e9%85%8d%e7%bd%ae-%e5%85%a8%e8%bf%87%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.shuran.cn\/?p=351","title":{"rendered":"CentOS-6.4-x86_64-minimal \u6700\u5c0f\u5b89\u88c5\u4e0b\uff0cL+N+M+P\u914d\u7f6e \u5168\u8fc7\u7a0b"},"content":{"rendered":"<p>\u6700\u5c0f\u5b89\u88c5CentOS-6.4-x86_64-minimal<\/p>\n<p>1\u3001nginx\u7684\u914d\u7f6e<\/p>\n<blockquote><p>yum -y install pcre gcc pcre-devel<\/p>\n<p>yum -y install openssl-devel openssl<\/p>\n<p>yum -y install make<\/p>\n<p>.\/configure --prefix=\/home\/web\/nginx --conf-path=\/home\/web\/nginx\/conf\/nginx.conf --user=nginx --group=nginx --with-http_ssl_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_stub_status_module --with-file-aio --with-pcre<\/p>\n<p>make<\/p>\n<p>make install<\/p><\/blockquote>\n<p>\u914d\u7f6enginx\u7684conf\u6587\u4ef6<\/p>\n<blockquote><p>user nginx;<br \/>\nworker_processes 2;<\/p>\n<p>#error_log logs\/error.log;<br \/>\n#error_log logs\/error.log notice;<br \/>\n#error_log logs\/error.log info;<\/p>\n<p>#pid logs\/nginx.pid;<br \/>\nevents {<br \/>\nuse epoll;<br \/>\nworker_connections 10240;<br \/>\n}<br \/>\nhttp {<br \/>\ninclude mime.types;<br \/>\ndefault_type application\/octet-stream;<\/p>\n<p>#log_format main '$remote_addr - $remote_user [$time_local] \"$request\" '<br \/>\n# '$status $body_bytes_sent \"$http_referer\" '<br \/>\n# '\"$http_user_agent\" \"$http_x_forwarded_for\"';<\/p>\n<p>#access_log logs\/access.log main;<\/p>\n<p>sendfile on;<br \/>\ntcp_nopush on;<\/p>\n<p>server_names_hash_bucket_size 128;<br \/>\nclient_header_buffer_size 128k;<br \/>\nlarge_client_header_buffers 4 128k;<br \/>\nclient_max_body_size 50m;<\/p>\n<p>#keepalive_timeout 0;<br \/>\nkeepalive_timeout 120;<\/p>\n<p>#FastCgi Conf<br \/>\nfastcgi_connect_timeout 300;<br \/>\nfastcgi_send_timeout 300;<br \/>\nfastcgi_read_timeout 300;<\/p>\n<p>fastcgi_buffer_size 64k;<br \/>\nfastcgi_buffers 4 64k;<br \/>\nfastcgi_busy_buffers_size 128k;<br \/>\nfastcgi_temp_file_write_size 128k;<\/p>\n<p>#\u542f\u52a8\u9884\u538b\u7f29\u529f\u80fd\uff0c\u5bf9\u6240\u6709\u7c7b\u578b\u7684\u6587\u4ef6\u90fd\u6709\u6548<br \/>\ngzip_static on;<\/p>\n<p>#\u627e\u4e0d\u5230\u9884\u538b\u7f29\u6587\u4ef6\uff0c\u8fdb\u884c\u52a8\u6001\u538b\u7f29<br \/>\ngzip on;<br \/>\ngzip_min_length 1000;<br \/>\ngzip_buffers 4 16k;<br \/>\ngzip_comp_level 5;<br \/>\ngzip_types text\/plain application\/x-javascript text\/css application\/xml;<\/p>\n<p>#gzip\u516c\u5171\u914d\u7f6e<br \/>\n#gzip_http_version 1.1<br \/>\ngzip_proxied expired no-cache no-store private auth;<\/p>\n<p>#\u7ea0\u7ed3\u7684\u914d\u7f6e<br \/>\n#\u5bf9\u4e8eie\u6709\u4e2abug\uff0c\u54cd\u5e94vary\u5934\u540e\u5c06\u4e0d\u4f1a\u7f13\u5b58\u8bf7\u6c42\uff0c\u6bcf\u6b21\u90fd\u4f1a\u91cd\u65b0\u53d1\u65b0\u7684\u8bf7\u6c42\u3002\u6240\u4ee5\uff0c\u5bf9\u4e8eie 1-6\u76f4&gt;\u63a5\u7981\u7528gzip\u3002<br \/>\ngzip_disable \"MSIE [1-6]\\.\";<br \/>\n#\u5f00\u542fHttp Vary\u5934\uff0cvary\u5934\u4e3b\u8981\u63d0\u4f9b\u7ed9\u4ee3\u7406\u670d\u52a1\u5668\u4f7f\u7528\uff0c\u6839\u636eVary\u5934\u505a\u4e0d\u540c\u7684\u5904\u7406\u3002\u4f8b\u5982\uff0c\u5bf9\u4e8e\u652f&gt;\u6301gzip\u7684\u8bf7\u6c42\u53cd\u5411\u4ee3\u7406\u7f13\u5b58\u670d\u52a1\u5668\u5c06\u8fd4\u56degzip\u5185\u5bb9\uff0c\u4e0d\u652f\u6301gzip\u7684\u5ba2\u6237\u7aef\u8fd4\u56de\u539f\u59cb\u5185\u5bb9\u3002<br \/>\ngzip_vary on;<\/p>\n<p>aio on;<br \/>\ndirectio 1;<br \/>\noutput_buffers 1 128k;<\/p>\n<p>include webs\/*.conf;<\/p>\n<p>}<\/p><\/blockquote>\n<p>\u914d\u7f6e\u591a\u57df\u540d\u914d\u7f6e\u6587\u4ef6<\/p>\n<blockquote><p>mkdir \/home\/web\/nginx\/conf\/webs<\/p>\n<p>vi \/home\/web\/nginx\/conf\/webs\/defaults.conf<\/p>\n<p>server {<br \/>\nlisten 80;<br \/>\nserver_name XXX.COM;<\/p>\n<p>#access_log logs\/host.access.log main;<\/p>\n<p>root \/home\/www\/xxx.com;<br \/>\nindex index.html index.htm index.php default.php;<\/p>\n<p>#error_page 404 \/404.html;<\/p>\n<p># redirect server error pages to the static page \/50x.html<br \/>\nerror_page 500 502 503 504 \/50x.html;<br \/>\nlocation = \/50x.html {<br \/>\nroot html;<br \/>\n}<\/p>\n<p>location ~ \\.php$ {<br \/>\nfastcgi_pass 127.0.0.1:9000;<br \/>\nfastcgi_index index.php;<br \/>\ninclude fastcgi.conf;<br \/>\n}<br \/>\n}<\/p><\/blockquote>\n<p>nginx\u7684\u670d\u52a1\u542f\u52a8\u914d\u7f6e<\/p>\n<blockquote><p>groupadd nginx<br \/>\nuseradd -g nginx nginx<\/p>\n<p>vi \/etc\/init.d\/nginx<\/p>\n<p>-----------------------------<\/p>\n<p>#!\/bin\/sh<br \/>\n#<br \/>\n# nginx - this script starts and stops the nginx daemin<br \/>\n#<br \/>\n# chkconfig: 234 85 15<br \/>\n# description: Nginx is an HTTP(S) server, HTTP(S) reverse<br \/>\n# proxy and IMAP\/POP3 proxy server<br \/>\n# processname: nginx<br \/>\n# config: \/home\/web\/nginx\/conf\/nginx.conf<br \/>\n# pidfile: \/home\/web\/nginx\/logs\/nginx.pid<\/p>\n<p># Source function library.<br \/>\n. \/etc\/rc.d\/init.d\/functions<\/p>\n<p># Source networking configuration.<br \/>\n. \/etc\/sysconfig\/network<\/p>\n<p># Check that networking is up.<br \/>\n[ \"$NETWORKING\" = \"no\" ] &amp;&amp; exit 0<\/p>\n<p>nginx=\"\/home\/web\/nginx\/sbin\/nginx\"<br \/>\nprog=$(basename $nginx)<\/p>\n<p>NGINX_CONF_FILE=\"\/home\/web\/nginx\/conf\/nginx.conf\"<\/p>\n<p>lockfile=\/var\/lock\/subsys\/nginx<\/p>\n<p>start() {<br \/>\n[ -x $nginx ] || exit 5<br \/>\n[ -f $NGINX_CONF_FILE ] || exit 6<br \/>\necho -n $\"Starting $prog: \"<br \/>\ndaemon $nginx -c $NGINX_CONF_FILE<br \/>\nretval=$?<br \/>\necho<br \/>\n[ $retval -eq 0 ] &amp;&amp; touch $lockfile<br \/>\nreturn $retval<br \/>\n}<\/p>\n<p>stop() {<br \/>\necho -n $\"Stopping $prog: \"<br \/>\nkillproc $prog -QUIT<br \/>\nretval=$?<br \/>\necho<br \/>\n[ $retval -eq 0 ] &amp;&amp; rm -f $lockfile<br \/>\nreturn $retval<br \/>\n}<\/p>\n<p>restart() {<br \/>\nconfigtest || return $?<br \/>\nstop<br \/>\nstart<br \/>\n}<\/p>\n<p>reload() {<br \/>\nconfigtest || return $?<br \/>\necho -n $\"Reloading $prog: \"<br \/>\nkillproc $nginx -HUP<br \/>\nRETVAL=$?<br \/>\necho<br \/>\n}<\/p>\n<p>force_reload() {<br \/>\nrestart<br \/>\n}<\/p>\n<p>configtest() {<br \/>\n$nginx -t -c $NGINX_CONF_FILE<br \/>\n}<\/p>\n<p>rh_status() {<br \/>\nstatus $prog<br \/>\n}<\/p>\n<p>rh_status_q() {<br \/>\nrh_status &gt;\/dev\/null 2&gt;&amp;1<br \/>\n}<\/p>\n<p>case \"$1\" in<br \/>\nstart)<br \/>\nrh_status_q &amp;&amp; exit 0<br \/>\n$1<br \/>\n;;<br \/>\nstop)<br \/>\nrh_status_q || exit 0<br \/>\n$1<br \/>\n;;<br \/>\nrestart|configtest)<br \/>\n$1<br \/>\n;;<br \/>\nreload)<br \/>\nrh_status_q || exit 7<br \/>\n$1<br \/>\n;;<br \/>\nforce-reload)<br \/>\nforce_reload<br \/>\n;;<br \/>\nstatus)<br \/>\nrh_status<br \/>\n;;<br \/>\ncondrestart|try-restart)<br \/>\nrh_status_q || exit 0<br \/>\n;;<br \/>\n*)<br \/>\necho $\"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}\"<br \/>\nexit 2<br \/>\nesac<\/p>\n<p>-------------------------------<\/p>\n<p>chmod +x \/etc\/init.d\/nginx<\/p>\n<p>\/sbin\/chkconfig nginx on<\/p>\n<p>\/sbin\/chkconfig --list nginx<\/p>\n<p>nginx 0:off 1:off 2:on 3:on 4:on 5:on 6:off<\/p><\/blockquote>\n<p>\u81f3\u6b64\uff0cnginx\u914d\u7f6e\u5b8c\u6210\u3002<\/p>\n<p>2\u3001\u5b89\u88c5PHP\u3002<\/p>\n<p>\u4e0b\u8f7d\u6700\u65b0\u7248\u672c<\/p>\n<p>\u5b89\u88c5\u652f\u6301\u5e93\u5148<\/p>\n<blockquote><p>yum -y install libxml2-devel<br \/>\nyum -y install bzip2 bzip2-devel<br \/>\nyum -y install curl curl-devel<br \/>\nyum -y install libjpeg libjpeg-devel<br \/>\nyum -y install libpng libpng-devel<br \/>\nyum -y install freetype freetype-devel<br \/>\nyum -y install openldap openldap-devel<br \/>\ncp -frp \/usr\/lib64\/libldap* \/usr\/lib\/ ***64\u4f4d\u7684\u7cfb\u7edf\uff0c\u5fc5\u987b\u8fd9\u6837\u505a<br \/>\nwget ftp:\/\/mcrypt.hellug.gr\/pub\/crypto\/mcrypt\/libmcrypt\/libmcrypt-2.5.7.tar.gz<br \/>\ntar -zxvf libmcrypt-2.5.7.tar.gz<br \/>\ncd libmcrypt-2.5.7<br \/>\n.\/configure<br \/>\nmake<br \/>\nmake install<\/p><\/blockquote>\n<p>PHP\u7f16\u8bd1\u53c2\u6570<\/p>\n<blockquote><p>.\/configure --prefix=\/home\/web\/php --with-config-file-path=\/home\/web\/php --with-openssl --with-zlib --with-curl --enable-gd-native-ttf --with-mysql --with-libxml-dir --with-bz2 --with-gd --enable-ftp --enable-mbstring --with-mcrypt --with-mysqli --enable-embedded-mysqli --enable-zip --enable-fpm --with-pic --enable-sockets --with-png-dir --with-freetype-dir --with-iconv-dir --with-jpeg-dir --enable-bcmath --enable-inline-optimization --disable-debug --with-mhash --enable-pcntl --with-ldap=\/usr \u00a0--with-xmlrpc<\/p><\/blockquote>\n<p>\u901a\u8fc7make \u548cmake install\u4ee5\u540e<\/p>\n<blockquote><p>cp php.ini-production \/mnt\/web\/php\/php.ini<br \/>\ncp sapi\/fpm\/init.d.php-fpm \/etc\/init.d\/php-fpm<br \/>\ncp \/home\/web\/php\/etc\/php-fpm.conf.default \/home\/web\/php\/etc\/php-fpm.conf<\/p>\n<p>chmod +x \/etc\/init.d\/php-fpm<\/p>\n<p>chkconfig --add php-fpm<\/p>\n<p>chkconfig --level 2345 php-fpm on<\/p><\/blockquote>\n<p>\u8fd8\u6709\u4e00\u4e2aZend<\/p>\n<blockquote><p>yum -y install unzip<\/p>\n<p>wget https:\/\/github.com\/zend-dev\/ZendOptimizerPlus\/zipball\/master<\/p>\n<p>unzip master<\/p>\n<p>cd zendtech-ZendOptimizerPlus-d6f6e6f\/<\/p>\n<p>\/home\/web\/php\/bin\/phpize<\/p>\n<p>.\/configure --with-php-config=\/home\/web\/php\/bin\/php-config<br \/>\nmake<br \/>\nmake install<\/p>\n<p>vi \/home\/web\/php\/php.ini<\/p>\n<p>-------------<\/p>\n<p>zend_extension=\/home\/web\/php\/lib\/php\/extensions\/no-debug-non-zts-20121212\/opcache.so<br \/>\nopcache.memory_consumption=128<br \/>\nopcache.interned_strings_buffer=8<br \/>\nopcache.max_accelerated_files=4000<br \/>\nopcache.revalidate_freq=60<br \/>\nopcache.fast_shutdown=1<br \/>\nopcache.enable_cli=1<\/p><\/blockquote>\n<p>\u4e0b\u9762\u53ef\u4ee5\u542f\u52a8php\u4e86<\/p>\n<p>service php-fpm start<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u5c0f\u5b89\u88c5CentOS-6.4-x86_64-minimal 1\u3001nginx\u7684\u914d\u7f6e yum -y install\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.shuran.cn\/?p=351\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-351","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/www.shuran.cn\/index.php?rest_route=\/wp\/v2\/posts\/351","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shuran.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shuran.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shuran.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shuran.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=351"}],"version-history":[{"count":4,"href":"https:\/\/www.shuran.cn\/index.php?rest_route=\/wp\/v2\/posts\/351\/revisions"}],"predecessor-version":[{"id":406,"href":"https:\/\/www.shuran.cn\/index.php?rest_route=\/wp\/v2\/posts\/351\/revisions\/406"}],"wp:attachment":[{"href":"https:\/\/www.shuran.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=351"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shuran.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=351"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shuran.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}