LNMP 服务器配置

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


转载于:https://my.oschina.net/devwdj/blog/311386

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值