[root@dba01 eaccelerator-0.9.6.1]# cd ..
[root@dba01 ~]# tar zxvf PDO_MYSQL-1.0.2.tgz
[root@dba01 ~]# cd PDO_MYSQL-1.0.2
[root@dba01 PDO_MYSQL-1.0.2]# /usr/local/php/bin/phpize
[root@dba01 PDO_MYSQL-1.0.2]# ./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql && make && make install && cd
[root@dba01 ~]# yum -y install libevent libevent-devel
[root@dba01 ~]# tar -zxvf memcached-1.2.5.tar.gz
[root@dba01 ~]# cd memcached-1.2.5
[root@dba01 memcached-1.2.5]# ./configure --prefix=/usr/local/memcache && make && make install && cd
[root@dba01 ~]# tar -zxvf memcache-2.2.5.tgz
[root@dba01 ~]# cd memcache-2.2.5
[root@dba01 memcache-2.2.5]# /usr/local/php/bin/phpize
[root@dba01 memcache-2.2.5]# ./configure --with-php-config=/usr/local/php/bin/php-config && make && make install && cd
[root@dba01 ~]# sed -i 's#output_buffering = Off#output_buffering = On#' /usr/local/php/etc/php.ini
[root@dba01 ~]# sed -i "s#; always_populate_raw_post_data = On#always_populate_raw_post_data = On#g" /usr/local/php/etc/php.ini
[root@dba01 ~]# sed -i "s#; cgi.fix_pathinfo=0#cgi.fix_pathinfo=0#g" /usr/local/php/etc/php.ini
[root@dba01 ~]# mkdir -p /usr/local/eaccelerator_cache
[root@dba01 ~]# sed -i '1290a [eaccelerator]' /usr/local/php/etc/php.ini
[root@dba01 ~]# sed -i '1291a zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so"' /usr/local/php/etc/php.ini
[root@dba01 ~]# sed -i '1292a eaccelerator.shm_size="64"' /usr/local/php/etc/php.ini
[root@dba01 ~]# sed -i '1293a eaccelerator.cache_dir="/usr/local/eaccelerator_cache"' /usr/local/php/etc/php.ini
[root@dba01 ~]# sed -i '1294a eaccelerator.enable="1"' /usr/local/php/etc/php.ini
[root@dba01 ~]# sed -i '1295a eaccelerator.optimizer="1"' /usr/local/php/etc/php.ini
[root@dba01 ~]# sed -i '1296a eaccelerator.check_mtime="1"' /usr/local/php/etc/php.ini
[root@dba01 ~]# sed -i '1297a eaccelerator.debug="0"' /usr/local/php/etc/php.ini
[root@dba01 ~]# sed -i '1298a eaccelerator.filter=""' /usr/local/php/etc/php.ini
[root@dba01 ~]# sed -i '1299a eaccelerator.shm_max="0"' /usr/local/php/etc/php.ini
[root@dba01 ~]# sed -i '1300a eaccelerator.shm_ttl="3600"' /usr/local/php/etc/php.ini
[root@dba01 ~]# sed -i '1301a eaccelerator.shm_prune_period="3600"' /usr/local/php/etc/php.ini
[root@dba01 ~]# sed -i '1302a seaccelerator.shm_only="0"' /usr/local/php/etc/php.ini
[root@dba01 ~]# sed -i '1303a eaccelerator.compress="1"' /usr/local/php/etc/php.ini
[root@dba01 ~]# sed -i '1304a eaccelerator.compress_level="9"' /usr/local/php/etc/php.ini
[root@dba01 ~]# sed -i '58s#<!--##g' /usr/local/php/etc/php-fpm.conf
[root@dba01 ~]# sed -i '58s#-->##g' /usr/local/php/etc/php-fpm.conf
[root@dba01 ~]# sed -i '59s#<!--##g' /usr/local/php/etc/php-fpm.conf
[root@dba01 ~]# sed -i '59s#-->##g' /usr/local/php/etc/php-fpm.conf
[root@dba01 ~]# sed -i '63s#<!--##g' /usr/local/php/etc/php-fpm.conf
[root@dba01 ~]# sed -i '63s#-->##g' /usr/local/php/etc/php-fpm.conf
[root@dba01 ~]# sed -i '66s#<!--##g' /usr/local/php/etc/php-fpm.conf
[root@dba01 ~]# sed -i '66s#-->##g' /usr/local/php/etc/php-fpm.conf
[root@dba01 ~]# sed -i '63s#nobody#nginx#g' /usr/local/php/etc/php-fpm.conf
[root@dba01 ~]# sed -i '66s#nobody#nginx#g' /usr/local/php/etc/php-fpm.conf
[root@dba01 ~]# sed -i '79s#5#128#g' /usr/local/php/etc/php-fpm.conf
[root@dba01 ~]# sed -i '113s#1024#20480#g' /usr/local/php/etc/php-fpm.conf
[root@dba01 ~]# sed -i '132s#500#1024#g' /usr/local/php/etc/php-fpm.conf
[root@dba01 ~]# ulimit -SHn 65535
[root@dba01 ~]# /usr/local/php/sbin/php-fpm
[root@dba01 ~]# netstat -lntp|grep php-fpm
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 18005/php-fpm
[root@dba01 ~]# mkdir -p /var/www/memcache;mkdir -p /var/www/bbs
[root@dba01 ~]# cat /usr/local/nginx/conf/nginx.conf
user nginx nginx;
worker_processes 8;
error_log /app/logs/nginx_error.log crit;
pid /usr/local/nginx/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 65535;
events
{
use epoll;
worker_connections 20480;
}
http
{
include mime.types;
default_type application/octet-stream;
#charset gb2312;
log_format wikilogs '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
log_format bbslogs '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
#limit_zone crawler $binary_remote_addr 10m;
server
{
listen 80;
server_name wiki.jc.com;
index index.html index.htm index.php;
root /var/www/memcache;
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
access_log /app/logs/wikilogs.log wikilogs;
}
server
{
listen 80;
server_name www.jc.com;
index index.html index.htm index.php;
root /var/www/bbs;
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
access_log /app/logs/bbslogs.log bbslogs;
}
}
[root@dba01 ~]# vim /usr/local/php/etc/php.ini +1306 添加如下:
[memcache]
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/"
extension=memcache.so
[root@dba01 ~]# cd /etc/init.d/
[root@dba01 init.d]# rz -y
rz waiting to receive.
zmodem trl+C ȡ
100% 1 KB 1 KB/s 00:00:01 0 Errors
[root@dba01 init.d]# dos2unix nginx
dos2unix: converting file nginx to UNIX format ...
[root@dba01 init.d]# chmod 755 nginx
[root@dba01 init.d]# cat nginx
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemin
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
nginx="/usr/local/nginx/sbin/nginx"
prog=$(basename $nginx)
NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"
lockfile=/var/lock/subsys/nginx
start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
configtest || return $?
stop
start
}
reload() {
configtest || return $?
echo -n $"Reloading $prog: "
killproc $nginx -HUP
RETVAL=$?
echo
}
force_reload() {
restart
}
configtest() {
$nginx -t -c $NGINX_CONF_FILE
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit 2
esac
[root@dba01 init.d]# mkdir -p /app/logs
[root@dba01 init.d]# /etc/init.d/nginx stop
Stopping nginx: [ OK ]
[root@dba01 init.d]# netstat -lntp|grep nginx
[root@dba01 init.d]# /etc/init.d/nginx restart
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
Stopping nginx: [FAILED]
Starting nginx: [ OK ]
[root@dba01 init.d]# netstat -lntp|grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 18084/nginx
[root@dba01 init.d]# cd /var/www/memcache/
[root@dba01 memcache]# cat phpinfo.php
<?php
phpinfo();
?>
[root@dba01 memcache]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:CA:47:D4
inet addr:192.168.1.118 Bcast:255.255.255.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:feca:47d4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:263728 errors:0 dropped:0 overruns:0 frame:0
TX packets:172759 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:294558603 (280.9 MiB) TX bytes:19137975 (18.2 MiB)
测试:http://192.168.1.118/phpinfo.php
(责任编辑:IT) |