Nginx on the LAMP expansion in the original build on the basis of the installation of nginx [root @ localhost nginx-1.0.15] # yum install libxslt-devel [root @ localhost ~] # Tar xf pcre-8.33.tar.gz-C/usr/src/[root @ localhost ~] # Cd/usr/src/pcre-8.33/[root @ localhost pcre-8.33] #. /configure & make install [root @ localhost nginx-1.0.15] # wget http://nginx.org/download/nginx-1.0.15.tar.gz [root @ localhost nginx-1.0.15] #. /configure -- error-log-path =/var/log/nginx/error. log -- pid-path =/var/run/nginx. pid -- user = daemon -- group = daemon -- with-rtsig_module -- with-select_module -- with-poll_module -- with-ipv6 -- with-ht Tp_ssl_module -- with-http_realip_module -- with-http_addition_module -- with-http_xslt_module -- with-http_image_filter_module -- with-http_sub_module -- with-http_dav_module -- with-http_gzip_static_module -- with-http_flv_module -- with-http_perl_module -- with-perl =/usr/bin/perl -- http-log-path =/var/ log/nginx/access. log -- with-pcre =/usr/src/pcre-8.33/-- with-http_stub_status_module [root @ loc Alhost nginx-1.0.15] # make & make install [root @ localhost conf] # vi/usr/local/nginx/conf/nginx. conf user daemon; worker_processes 1; error_log/var/log/nginx/error. log info; pid/var/run/nginx. pid; events {worker_connections 1024;} http {include mime. types; default_type application/octet-stream; log_format main '$ remote_addr-$ remote_user [$ time_local] "$ request" ''$ status $ body_bytes_sent "$ Http_referer" ''" $ http_user_agent "" $ http_x_forwarded_for "'; access_log/var/log/nginx/access. log main; sendfile on; # tcp_nopush on; # keepalive_timeout 0; keepalive_timeout 65; # gzip on; server {listen 80; server_name localhost; charset gb2312; access_log/var/log/nginx/access. log main; location/{root/www; index index.html index.htm;} error_page 404/404 .html; # redirect server error page S to the static page/50x.html # error_page 500 502 503 x.html; location =/50x.html {root/www;} location ~ \. Php $ {root/www; fastcgi_pass 127.0.0.1: 9000; fastcgi_index index. php; fastcgi_param SCRIPT_FILENAME/www $ fastcgi_script_name; include fastcgi_params;} [root @ localhost nginx] # cd sbin/[root @ localhost sbin] # lsng.pdf [root @ localhost sbin] #. /nginx [root @ localhost sbin] # lsof-I: 80 COMMAND PID USER FD TYPE DEVICE SIZE NODE nameng1_14359 root 6u IPv4 21618 TCP *: http (LISTEN) nginx 14360 daemon 6 U IPv4 21618 TCP *: http (LISTEN) [root @ localhost sbin] # pwd/usr/local/nginx/sbin PHP installation [root @ localhost ~] # Tar xf/softs/php-5.3.27.tar.bz2-C/usr/src/[root @ localhost php-5.3.27] #. /configure -- disable-ipv6 -- with-libxml-dir =/usr -- with-openssl =/usr -- with-pcre-regex =/usr/local -- with-zlib =/usr -- with-bz2 =/usr -- enable-calendar -- with-curl =/usr -- with-pcre-dir =/usr/local -- enable-ftp -- with-openssl-dir =/usr -- -gd =/usr/local -- with-jpeg-dir =/usr/local -- with-png-dir =/usr/local -- with-zlib-dir =/us R/local -- with-xpm-dir =/usr -- with-freetype-dir =/usr/local -- enable-gd-native-ttf -- enable-gd-jis-conv -- with-mhash =/usr/local -- enable-mbstring -- with-mcrypt =/usr/local -- with-mysql =/usr/local/mysql -- with-mysql-sock =/ var/run/mysqld/mysql5.socket -- with-mysqli =/usr/local/mysql/bin/mysql_config -- with-snmp =/usr -- enable-sockets -- enable-zip & make & make install [root @ localhost cgi] #. /php-cgi- A-B 127.0.0.1: 9000-c/usr/local/lib/php. ini & [2] 9879 [1] Isn't the cross-stick?. /Php-cgi-a-B 127.0.0.1: 9000-c/usr/local/lib/php. ini [root @ localhost cgi] # pwd/usr/src/php-5.3.27/sapi/cgi Access 127.0.0.1/index. php currently only has one php-cgi process. This is not enough for a large number of concurrent requests. So I use the stress testing software http_load test [root @ localhost softs] # wget http://icn.me/http_load_tar_gz [root @ localhost http_load-12mar2006] # make & make install [root @ localhost www] # http_load-parallel 100-seconds 10 url.txt http: // 192.168.254.153/. php: byte count wronghttp: // 192.168.254.153/. php: byte count wronghttp: // 192.168.254.153/. php: byte count wronghttp: // 192.168.254.153/. php: byte count wronghttp: // 192.168.254.153/. php: byte count distinct fetches, 100 max parallel, 5.06531e + 06 bytes, in 10 seconds166.452 mean bytes/connection3043.1 fetches/sec, 506531 bytes/secmsecs/connect: 0.272351 mean, 137.327 max, 0.012 minmsecs/first-response: 17.6569 mean, 3034.86 max, 0.097 min29934 bad byte countsHTTP response codes: code 200 -- 497 code 404 -- 29934 when the number of concurrent threads is 100, it crashes, therefore, we need to generate multiple php-cgi processes, here we introduce a tool spqwn-fcgi [root @ localhost spawn-fcgi-1.6.3] # wget http://download.lighttpd.net/spawn-fcgi/releases-1.6.x/spawn-fcgi-1.6.3.tar.gz [root @ localhost spawn-fcgi-1.6.3] # tar xf spawn-fcgi-1.6.3.tar.gz [root @ localhost spawn-fcgi-1.6.3] # cd spawn-fcgi-1.6.3 [root @ localhost spawn-fcgi-1.6.3] #. /configure & make install [root @ localhost src] # spawn-fcgi-f/usr/local/bin/phpspawn-fcgi: no socket given (use either-p or-s) [root @ localhost src] # spawn-fcgi-f/usr/local/bin/php-cgi-a 127.0.0.1-u daemon-p 9000-C 150spawn-fcgi: child spawned successfully: PID: 11498 [root @ localhost src] # ps-e | grep php | wc 151 604 4832 [root @ localhost www] # http_load-parallel 100-seconds 10 url.txt 33289 fetches, 100 max parallel, 432757 bytes, in 10 seconds13 mean bytes/connection3328.9 fetches/sec, 43275.7 bytes/secmsecs/connect: 0.0322589 mean, 0.809 max, 0.024 minmsecs/first-response: 29.9192 mean, 117.142 max, 8.778 minHTTP response codes: code 200 -- 33289