һ ��װnginx
nginx��fastcgi��ʽ����php
nginx-1.4.7.tar.gz
�� ��װmysql
mysql-5.6.31-linux-glibc2.5-x86_64
�� ��װphp
php-5.6.9
1 ��װ�������ļ�����epel�У�����ѡ���Եİ�װ
libmcrypt libmcrypt-devel mhash mhash-devel mcrypt bzip2 bzip2-devel libcurl libcurl-devel libxml2 libxml2-devel
--with-snmpѡ��������ʵ��php��SNMP��չ�����˹���Ҫ����ǰ��װnet-snmp��������
2 ��װphp
# tar xf php-5.4.4.tar.bz2
# cd php-5.4.4
# ./configure \
--prefix=/usr/local/php \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--with-mysql=/usr/local/mysql \
--with-openssl \
--enable-fpm \
--enable-sockets \
--enable-sysvshm \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--enable-mbstring \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-libxml-dir \
--enable-xml \
--with-mhash \
--with-mcrypt \
--with-bz2 \
--with-curl
˵����
--with-config-file-path=PATH Set the path in which to look for php.ini [PREFIX/lib]
--with-config-file-scan-dir=PATH Set the path where to scan for configuration files
# make
# make test
# make intall
2 Ϊphp�ṩ�����ļ���
# cp php.ini-production /etc/php.ini
3 Ϊphp-fpm�ṩ�����ļ���
# cd /usr/local/php/etc/
# mv php-fpm.conf.default php-fpm.conf
# vim /usr/local/php/etc/php-fpm.conf
����fpm�����ѡ��Ϊ������Ҫ��ֵ��������pid�ļ����������һ�У���
pm.max_children = 150
pm.start_servers = 8
pm.min_spare_servers = 5
pm.max_spare_servers = 10
4 Ϊphp-fpm�ṩSysv init�ű�������������������б?
# cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm
# chmod +x /etc/rc.d/init.d/php-fpm
# chkconfig --add php-fpm
# chkconfig php-fpm on
5 ����php-fpm
# service php-fpm start
6 ʹ������������������������������м���php-fpm��̾�˵�������ɹ��ˣ���
# ps aux | grep php-fpm
�ġ����nginx��php5
1 �༭/etc/nginx/nginx.conf����������ѡ�
location ~ \.php$ {
root /web/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
2 �༭/etc/nginx/fastcgi_params���������ݸ��Ϊ�������ݣ�
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
3 ������֧�ֵ���ҳ���ʽ�����php��ʽ����ҳ���������£�
location / {
root html;
index index.php index.html index.htm;
}
4 ��������nginx�������ļ���
# service nginx reload
5 ��/usr/html�½�index.php�IJ���ҳ�棬����php�Ƿ���������
# cat > /usr/html/index.php << EOF
<?php
phpinfo();
?>
���žͿ���ͨ����������ʴ˲���ҳ���ˡ�
�� ��װxcache��Ϊphp���٣�
1����װ
# tar xf xcache-3.2.0.tar.gz
# cd xcache-3.2.0
# /usr/local/php/bin/phpize
# ./configure --enable-xcache --with-php-config=/usr/local/php/bin/php-config
# make && make install
��װ����ʱ����������������У�
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20100525/
2���༭php.ini�����php��xcache��
���Ƚ�xcache�ṩ���������õ���php.ini
# mkdir /etc/php.d
# cp xcache.ini /etc/php.d
˵����xcache.ini�ļ���xcache��Դ��Ŀ¼�С�
�°��xcache�˴�������
�������༭/etc/php.d/xcache.ini���ҵ�zend_extension��ͷ���У���Ϊ�����У�
zend_extension = /usr/local/php/lib/php/extensions/no-debug-zts-20100525/xcache.so
ע�⣺���php.ini�ļ����ж���zend_extensionָ���У�Ҫȷ���������������ڵ�һλ��
3����������php-fpm
# service php-fpm restart
����˵��
���Ҫ��SSL��ʹ��php����Ҫ��php��location����Ӵ�ѡ�
fastcgi_param HTTPS on;
����Ϊ֪�ʼ�(Wiz)