yum -y install gcc gcc-c++ autoconf automake
yum -y install zlib zlib-devel openssl openssl-devel pcre-devel
#php
./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php\
--with-gd=/usr/local/libgd \
--enable-gd-native-ttf \
--with-freetype-dir=/usr/local/freetype \
--with-jpeg-dir=/usr/local/libjpeg \
--with-png-dir=/usr/local/libpng \
--with-zlib-dir=/usr/local/zlib \
--with-curl \
--enable-zip \
--with-pcre-regex \
--with-mysql \
--disable-pdo \
--enable-fpm \
--enable-fastcgi \
--enable-force-cgi-redirect \
--enable-ftp \
--enable-zip \
--with-gettext \
--with-ttf \
--enable-calendar \
--enable-bcmath \
--enable-exif \
--enable-xml \
--enable-mbstring \
--enable-sockets \
--enable-soap \
--with-mcrypt \
--with-mhash \
--with-openssl \
'--with-pdo-oci=instantclient,/root/instantclient_10_2,10.2' \
'--with-oci8=instantclient,/root/instantclient_10_2' \
'--with-pdo-mysql=/usr/' \
'--with-mysql=/usr/'
make
make install
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
#nginx
./configure \
--prefix=/usr \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx/nginx.pid \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_gzip_static_module \
--http-log-path=/var/log/nginx/access.log \
--http-client-body-temp-path=/var/tmp/nginx/client \
--http-proxy-temp-path=/var/tmp/nginx/proxy \
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi \
--with-http_stub_status_module
#nginx user
groupadd -r nginx
useradd -s /sbin/nologin -g nginx -r nginx
id nginx
#!/bin/sh
#
# chkconfig: 2345 08 92
#
### BEGIN INIT INFO
# Provides: iptables
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
#
#PHP_INI='/etc/php.ini'
BIN_PATH='/usr/local/nginx/nginx'
RUN_CMD="$BIN_PATH"
PID_FILE='/usr/local/nginx/nginx.pid'
# if [ $# -ne 1 ];then
# echo "Usage: $0 --help see help document"
# exit 1
# fi
getPID()
{
if [[ -f $PID_FILE ]]; then
pid=$(cat ${PID_FILE})
if [ -n "$pid" -a "$pid" = "${pid//[^0-9]/}" ]; then
echo $pid
else
echo 0
fi
else
echo 0
#echo "${PID_FILE} not foud!"
#exit 1;
fi
}
start()
{
if [[ -x $BIN_PATH ]]; then
pid=`getPID`;
if [[ $pid>0 ]]; then
ps=$(ps x|grep ${pid})
fi
if [[ -z $ps ]]; then
echo `$RUN_CMD` 'start success!'
else
echo 'is running pid('$pid')'
fi
else
echo "ERROR: file $BIN_PATH not foud!"
fi
}
stop()
{
pid=`getPID`;
if [[ $pid>0 ]]; then
ps=$(ps x|grep ${pid})
fi
if [[ -z $ps ]]; then
echo "is not running"
else
kill -QUIT $pid
echo "stop success"
fi
}
reload()
{
pid=`getPID`;
if [[ $pid>0 ]]; then
ps=$(ps x|grep ${pid})
fi
if [[ -z $ps ]]; then
echo "is not running"
else
echo "reload..."
kill -HUP $pid
echo "reload success"
fi
}
status()
{
pid=`getPID`;
if [ $pid -eq 0 ]; then
echo "is not running"
else
echo "is running pid(${pid})"
fi
}
case $1 in
"start" )
start;
;;
"stop" )
stop;
;;
"status" )
status;
;;
"reload" )
reload;
;;
"restart" )
stop;
start;
;;
* ) echo "Usage: $0 {start|stop|reload|restart|status}";;
esac
#!/bin/sh
#
# chkconfig: 2345 08 92
#
### BEGIN INIT INFO
# Provides: iptables
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
#
PHP_INI='/etc/php.ini'
BIN_PATH='/usr/local/php/sbin/php-fpm'
RUN_CMD="$BIN_PATH -c $PHP_INI"
PID_FILE='/usr/local/php/var/run/php-fpm.pid'
# if [ $# -ne 1 ];then
# echo "Usage: $0 --help see help document"
# exit 1
# fi
getPID()
{
if [[ -f $PID_FILE ]]; then
pid=$(cat ${PID_FILE})
if [ -n "$pid" -a "$pid" = "${pid//[^0-9]/}" ]; then
echo $pid
else
echo 0
fi
else
echo 0
#echo "${PID_FILE} not foud!"
#exit 1;
fi
}
start()
{
if [[ -x $BIN_PATH ]]; then
pid=`getPID`;
if [[ $pid>0 ]]; then
ps=$(ps x|grep ${pid})
fi
if [[ -z $ps ]]; then
echo `$RUN_CMD` 'start success!'
else
echo 'is running pid('$pid')'
fi
else
echo "ERROR: file $BIN_PATH not foud!"
fi
}
stop()
{
pid=`getPID`;
if [[ $pid>0 ]]; then
ps=$(ps x|grep ${pid})
fi
if [[ -z $ps ]]; then
echo "is not running"
else
kill -QUIT $pid
echo "stop success"
fi
}
reload()
{
pid=`getPID`;
if [[ $pid>0 ]]; then
ps=$(ps x|grep ${pid})
fi
if [[ -z $ps ]]; then
echo "is not running"
else
echo "reload..."
kill -USR2 $pid
echo "reload success"
fi
}
status()
{
pid=`getPID`;
if [ $pid -eq 0 ]; then
echo "is not running"
else
echo "is running pid(${pid})"
fi
}
case $1 in
"start" )
start;
;;
"stop" )
stop;
;;
"status" )
status;
;;
"reload" )
reload;
;;
"restart" )
stop;
start;
;;
* ) echo "Usage: $0 {start|stop|reload|restart|status}";;
esac