centos中源码编译nginx
来源:互联网 发布:网络被高智慧生物屏蔽 编辑:程序博客网 时间:2024/05/17 23:03
mkdir /usr/local/nginx
先安装pcre,Rewrite模块需要
tar zxvf pcre-8.10.tar.gz
cd pcre-8.10/./configure
make && make install
groupadd -r nginx
useradd -r -g nginx -s /bin/false -M nginx
tar -zxvf nginx-1.7.10
cd nginx-1.7.10
./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre --with-http_realip_module --with-http_gzip_static_module --with-file-aio
make && make install
添加启动脚本:vim /etc/init.d/nginx
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# 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
# config: /etc/sysconfig/nginx
# 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"
[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
lockfile=/var/lock/subsys/nginx
make_dirs() {
# make required directories
user=`nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -`
options=`$nginx -V 2>&1 | grep 'configure arguments:'`
for opt in $options; do
if [ `echo $opt | grep '.*-temp-path'` ]; then
value=`echo $opt | cut -d "=" -f 2`
if [ ! -d "$value" ]; then
# echo "creating" $value
mkdir -p $value && chown -R $user $value
fi
fi
done
}
start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
make_dirs
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
sleep 1
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
启动脚本到这里介绍。
开启php支持,vim /usr/local/nginx/conf/nginx.conf
chmod +x /etc/init.d/nginx
chkconfig --add nginx
chkconfig nginx on
service nginx start
- centos中源码编译nginx
- CentOS源码编译安装Nginx
- Linux(CentOS) - 源码编译安装Nginx
- centos 下nginx源码编译安装
- 在CentOS下源码编译安装nginx教程
- linux centos源码编译安装Nginx和PHP
- 在Windows中编译Nginx源码
- 在Windows中编译Nginx源码
- centos 编译安装nginx
- Centos编译安装nginx
- Centos 源码安装 nginx
- centos源码安装nginx
- centos 源码安装Nginx
- RHEL/CentOS 7 系统上源码编译安装nginx,并隐藏替换nginx名称
- centos中编译安装nginx并支持ssl
- Nginx 源码编译
- 源码编译nginx,php
- nginx 源码编译
- android使用httppost向c# wcf发送数据总结
- java用HashSet集合判断重复问题。
- oracle查看数据库锁表情况
- 如何学好一门编程语言或技术?
- Visio安装失败 无法打开注册表项 解决方案
- centos中源码编译nginx
- 如何让自己内心宁静平和?
- LeetCode --- 46. Permutations
- SQL 遍历父子关系表(二叉树)获得所有子节点 所有父节点(转)
- Gson Jackson JSON-lib 性能比较
- 数据库连接
- 每一天都这么干:(1)打篮球40个
- operator
- plsql 常用函数