源码安装nginx
来源:互联网 发布:java彩虹六号安卓版 编辑:程序博客网 时间:2024/06/04 19:34
一、安装nginx
安装步骤:
1\\下载使用稳定版本:nginx-1.8.1.tar.gz
2\\使用ssh工具复制到/home目录下,解压—》tar –zxvf nginx-1.8.1.tar.gz
3\\进入解压后的目录: cd /home/nginx-1.8.1 --à执行预编译命令
#./configure --prefix=/home/nginx(此处的/home/nginx目录是安装目录) ---à回车
A、如果预编译,检查没有错误则说明正确!可以下一步安装
B、如果有错误,查看当前版本---》yum info ?(如zlib)
(1)然后安装对应得版本,本次安装时,需要jdk对应nginx版本都是开发者版本:
”yum –y install pcre-devel”、”yum –y install zlib-devel”
强制卸载: “rpm -e --nodeps pcre ”
(2)再检查./configure --prefix=/home/nginx没有错误
4\\在刚才的解压目录下(cd /home/nginx-1.8.1)下,执行make命令---》然后make install
5\\访问不成功,说明防火墙开着
需要关闭防火墙---------》service iptables status -------àservice iptables stop(close)
查看开机是否启动à chkconfig --list | grep ntp----à关闭chkconfig iptables off(on)
查看进程—》[root@node4 logs]# ps aux | grep nginx-----》杀死进程:kill pid
6\\浏览器访问:192.168.142.102即可
优点:可以自定义添加nginx的功能模块
二、安装tengine
A---解压tengine.tar.gz到home目录下
B---在解压目录下,执行预编译检查
./configure \
--prefix=/opt/sxt/soft/tengine-2.1.0/ \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--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/ \
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
--http-scgi-temp-path=/var/tmp/nginx/scgi \
--with-pcre
(a)检查正常:在当前解压目录下执行”make && make install ”
(b)如果检查异常:根据需要安装开发者包
C---添加到注册表:vim /etc/network
D---进入” /etc/network”目录下,新建nginx,将nginx里面的内容(查看本文备注)拷贝进来,
注意三点,a)新建文件,b)编辑模式,c)这里要修改两个参数
nginx="/opt/sxt/soft/tengine-2.1.0/sbin/nginx"
NGINX_CONF_FILE="/opt/sxt/soft/tengine-2.1.0/conf/nginx.conf"
E---在” /etc/network”目录下,修改权限可执行,#chmod 755 nginx
F---递归调用创建需要的文件夹 mkdir –p /var/tmp/nginx/client/
G --service nginx start(stop,restart) 启动正常结果
the configuration file /opt/sxt/soft/tengine-2.1.0/conf/nginx.conf syntax is ok
configuration file /opt/sxt/soft/tengine-2.1.0/conf/nginx.conf test is successful
Stopping nginx: [ OK ]
Starting nginx: [ OK ]
M不用yum安装----》原因源安装是可以安装模块,而yum则不行,必须卸载后才能重新安装
备注一:tengine的配置:新建的nginx文件在---》 cd /etc/network目录下
#!/bin/bash
#
# chkconfig: - 85 15
# description: nginx is a World Wide Web server. It is used to serve
# 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/tengine-2.1/sbin/nginx"
prog=$(basename $nginx)
NGINX_CONF_FILE="/usr/tengine-2.1/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: "
# -HUP是nginx平滑重启参数
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
- Nginx-----源码安装nginx
- 源码安装Nginx
- nginx 源码安装
- nginx源码安装
- Centos 源码安装 nginx
- nginx源码安装
- nginx源码安装记事
- nginx源码安装
- 从源码安装nginx
- Nginx源码安装
- nginx源码安装
- centos源码安装nginx
- 源码安装nginx
- nginx 源码安装配置
- ubuntu 源码安装 nginx
- centos 源码安装Nginx
- nginx 源码包安装
- Nginx源码安装
- stm32 学习经历—环境搭建 以103 407搭建 3/2
- 2012年寒假•青年基金【修改后发表】
- css3 图片颜色叠加--background-blend-mode
- jsp页面中c标签 运用
- SIM9000A SIM模块GPRS测试--记录这一路的喜乐
- 源码安装nginx
- POI的HSSFRichTextString的使用简介 .
- 故事版冲突The document "me.storyboard" could not be opened. Unrecognized file content.
- JAVA 求中文首字母(大小写)
- 编程规范 --- 可测性
- Ngios安装配置
- stringbuffer与stringbuilder的区别
- ByteArrayInputStream的用法解析
- Aurora公式编辑器在64位Word 2013不显示选项卡