Tengine version:2.0.3 Dependency Package: Pcre version:8.35
Install dependent packages [ edit ]
Yum Install gcc make-ywget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.21.tar.gztar-zxvf Pcre-8.35.tar.gz-c/usr/local/yum install-y gd gd-develyum install OpenSSL openssl-devel-y
Installing Tengine [ edit ]
Groupadd wwwuseradd www-g www-s/sbin/nologintar zxvf tengine-2.0.3.tar.gzcd tengine-2.0.3./configure--user=www--grou P=www--prefix=/usr/local/webserver/tengine--with-http_stub_status_module--with-http_ssl_module--with-pcre=/usr /local/pcre-8.35--with-http_realip_module--with-http_image_filter_modulemakemake INSTALLCD. /--prefix=/usr/local/webserver/tengine Specify the program installation location--with-http_stub_status_modulenginx working status Module--with-http_ssl_ Module enables SSL support and is capable of handling HTTPS requests. --with-pcre=/usr/local/pcre-8.35 Set pcre Library source file path--with-http_realip_module get real IP module--with-http_image_filter_module
Start [ edit ]
Ensure that the 80 port of the system is not occupied by other programs,/usr/local/webserver/tengine/sbin/nginx
Check whether the start is successful [ edit ]
NETSTAT-ANO|GREP 80 Results Input Description started successfully
PHP Installation [ edit ]
Please refer to the PHP5.5 installation documentation
Nginx Optimization [ edit ]
Detailed Nginx parameter optimization
PHP Optimization [ edit ]
PHP-FPM parameter explanation
PHP.ini parameter explanation
Kernel Optimizations [ edit ]
The number of net.ipv4.tcp_max_tw_buckets = 6000timewait , by default, is 180000. NET.IPV4.IP_LOCAL_PORT_RANGE = 1024 65000 allows the system to open a range of ports. Net.ipv4.tcp_tw_recycle = 1 Enable timewait Quick Recycle. Net.ipv4.tcp_tw_reuse = 1 turn on reuse. Allows time-wait sockets to be re-used for new tcp connections. Net.ipv4.tcp_syncookies = 1 turns on Syn cookies, cookies is enabled when a syn wait queue overflow occurs. backlog of listen function in net.core.somaxconn = 262144web application The default is to limit the net.core.somaxconn of our kernel parameters to 128, while the nginx definition of ngx_listen_backlog defaults to 511, so it is necessary to adjust this value. NET.CORE.NETDEV_MAX_BACKLOG = 262144 the maximum number of packets that are allowed to be sent to the queue when each network interface receives a packet at a rate that is faster than the rate at which the kernel processes these packets. The maximum number of TCP sockets in the NET.IPV4.TCP_MAX_ORPHANS = 262144 system are not associated with any one of the user file handles. If this number is exceeded, the orphan connection is immediately reset and a warning message is printed. This limitation is only to prevent a simple Dos attack, not to rely too much on it or artificially reduce the value, but should increase this value (if the memory is increased). NET.IPV4.TCP_MAX_SYN_BACKLOG = 262144 records the maximum number of connection requests that have not yet received the client acknowledgment information. For systems with 128M of memory, the default value is 1024, and the small memory system is 128. The net.ipv4.tcp_timestamps = 0 time stamp avoids winding the serial number. A 1Gbps link will definitely encounter a previously used serial number. Timestamps allow the kernel to accept this "Exception "packet. You need to turn it off here. Net.ipv4.tcp_synack_retries = 1 in order to open the connection to the end, the kernel needs to send a syn with an ACK that responds to the previous syn. The second handshake in the so-called three-time handshake. This setting determines the number of syn+ack packets sent before the kernel abandons the connection. Net.ipv4.tcp_syn_retries = 1 the number of syn packets sent before the kernel abandons the connection. Net.ipv4.tcp_fin_timeout = 1 If the socket is closed by this side, this parameter determines how long it remains in the fin-wait-2 state. The peer can make an error and never shut down the connection, or even accidentally become a machine. The default value is 60 seconds. The usual value for the 2.2 kernel is 180 seconds, 3 You can press this setting, but remember that even if your machine is a light load web server, there is a risk of memory overflow due to a lot of dead sockets,fin-wait-2 is less dangerous than fin-wait-1 because it can only eat 1.5k memory, but their lifetime is longer. Net.ipv4.tcp_keepalive_time = 30 the frequency of sending keepalive messages when keepalive ,tcp . The default is 2 hours.
XCache Installation [ edit ]
wget http://xcache.lighttpd.net/pub/releases/2.0.0/xcache-2.0.0.tar.gztar -zxvf xcache-2.0.0.tar.gzcd xcache-2.0.0/usr/local/php/bin/phpize./configure --enable-xcache -- When the with-php-config=/usr/local/php/bin/php-configmakemake test is complete, you are prompted to generate the xcache.so in/usr/local/php/lib/php/ The extensions/no-debug-non-zts-20090626/directory. Then add the following to the php.ini: [xcache-common]zend_extension = /usr/local/php/lib/ php/extensions/no-debug-non-zts-20090626/xcache.so[xcache.admin]xcache.admin.user = " Admin "xcache.admin.pass = " 8a488a9ed9dc3634f70b421b06d835e5 "[xcache]xcache.size = 64Mxcache.shm_scheme = "Mmap" xcache.count = 2xcache.slots = 8Kxcache.ttl = 0xcache.gc_interval = 0xcache.var_size = 8mxcache.var_count = 4xcache.var_slots = 8Kxcache.var_ttl = 0xcache.var_maxttl = 0xcache.var_gc_interval = 300xcache.test = offxcache.readonly_ protection = onxcache.mmap_path = "/dev/shm/xcache" Xcache.coredump_ directory = "" xcache.cacher = onxcache.stat = onxcache.optimizer = offxcache.coverager = off
Then create the XCache file in the/dev/shm/directory and give 777 permission to touch Xcache/dev/shm/xcachechmod 777/dev/shm/xcache
Re-start Nginx
This article is from "Smile_ Youth" blog, please be sure to keep this source http://smileyouth.blog.51cto.com/7273768/1579975
nginx+php Installation Configuration and optimization