【资料整理】编译安装nginx
【nginx】编译安装nginx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
nginx编译安装
要安装passenger模块,因此,需编译安装。
[root@test1 download] # yum install pcre pcre-devel
[root@test1 download] # wget http://nginx.org/download/nginx-1.6.2.tar.gz
[root@test1 download] # tar zxvf nginx-1.6.2.tar.gz && cd nginx-1.6.2
[root@test1 download] # ./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-http_spdy_module --with-cc-opt='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --with-pcre=/tmp/passenger.hfmv10/pcre-8.34 --add-module=/usr/lib/ruby/gems/1.8/gems/passenger-4.0.41/ext/nginx
[root@test1 nginx-1.6.2] # make && make install
[root@test1 nginx-1.6.2] # cd /etc/nginx
拷贝原来的nginx配置文件:
[root@test1 nginx] # cp -a /data/svr/nginx/conf/nginx.conf .
[root@test1 nginx] # cp -a /data/svr/nginx/conf/conf.d/ .
创建目录:
[root@test1 nginx] # mkdir -p /var/cache/nginx/{client_temp,proxy_temp,fastcgi_temp,uwsgi_temp,scgi_temp}
停止原来nginx
[root@test1 nginx] # /data/svr/nginx/sbin/nginx -s stop
取消 /etc/rc . local 下nginx启动命令
启用新的nginx
[root@test1 nginx] # service nginx start
nginx控制脚本:
[root@test1 nginx] # cat /etc/init.d/nginx
#!/bin/sh
#
# nginx Startup script for nginx
#
# chkconfig: - 85 15
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
# pidfile: /var/run/nginx.pid
# description: nginx is an HTTP and reverse proxy server
#
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop nginx
### END INIT INFO
# Source function library.
. /etc/rc .d /init .d /functions
if [ -L $0 ]; then
initscript=` /bin/readlink -f $0`
else
initscript=$0
fi
sysconfig=` /bin/basename $initscript`
if [ -f /etc/sysconfig/ $sysconfig ]; then
. /etc/sysconfig/ $sysconfig
fi
nginx=${NGINX- /usr/sbin/nginx }
prog=` /bin/basename $nginx`
conffile=${CONFFILE- /etc/nginx/nginx .conf}
lockfile=${LOCKFILE- /var/lock/subsys/nginx }
pidfile=${PIDFILE- /var/run/nginx .pid}
SLEEPMSEC=${SLEEPMSEC-200000}
UPGRADEWAITLOOPS=${UPGRADEWAITLOOPS-5}
RETVAL=0
start() {
echo -n $ "Starting $prog: "
daemon --pidfile=${pidfile} ${nginx} -c ${conffile}
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
stop() {
echo -n $ "Stopping $prog: "
killproc -p ${pidfile} ${prog}
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
echo -n $ "Reloading $prog: "
killproc -p ${pidfile} ${prog} -HUP
RETVAL=$?
echo
}
upgrade() {
oldbinpidfile=${pidfile}.oldbin
configtest -q || return
echo -n $ "Starting new master $prog: "
killproc -p ${pidfile} ${prog} -USR2
echo
for i in ` /usr/bin/seq $UPGRADEWAITLOOPS`; do
/bin/usleep $SLEEPMSEC
if [ -f ${oldbinpidfile} -a -f ${pidfile} ]; then
echo -n $ "Graceful shutdown of old $prog: "
killproc -p ${oldbinpidfile} ${prog} -QUIT
RETVAL=$?
echo
return
fi
done
echo $ "Upgrade failed!"
RETVAL=1
}
configtest() {
if [ "$#" - ne 0 ] ; then
case "$1" in
-q)
FLAG=$1
;;
*)
;;
esac
shift
fi
${nginx} -t -c ${conffile} $FLAG
RETVAL=$?
return $RETVAL
}
rh_status() {
status -p ${pidfile} ${nginx}
}
# See how we were called.
case "$1" in
start)
rh_status > /dev/null 2>&1 && exit 0
start
;;
stop)
stop
;;
status)
rh_status
RETVAL=$?
;;
restart)
configtest -q || exit $RETVAL
stop
start
;;
upgrade)
rh_status > /dev/null 2>&1 || exit 0
upgrade
;;
condrestart|try-restart)
if rh_status > /dev/null 2>&1; then
stop
start
fi
;;
force-reload|reload)
reload
;;
configtest)
configtest
;;
*)
echo $ "Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|upgrade|reload|status|help|configtest}"
RETVAL=2
esac
exit $RETVAL
|
【资料整理】编译安装nginx相关推荐
- CentOS6.6 32位 Minimal版本纯编译安装Nginx Mysql PHP Memcached
声明:部分编译指令在博客编辑器里好像被处理了,如双横线变成单横线了等等,于是在本地生成了一个pdf版本,在下面地址可以下载. LNMP+Memcached CentOS是红帽发行的免费的稳定Linux ...
- Ubuntu 17.04 编译安装 Nginx 1.9.9 配置 https 免费证书
Ubuntu 17.04 编译安装 Nginx 1.9.9 配置 https 免费证书 安装 Nginx 安装依赖 $ apt-get update $ apt-get install build-e ...
- Ubuntu 16.04源码编译安装nginx 1.10.0
一.下载相关的依赖库 pcre 下载地址 http://120.52.73.43/jaist.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.t ...
- CentOS上编译安装Nginx
背景 为了解决CentOS7.2自带的Nginx上没有auth-request支持的问题,需要自己手工编译安装Nginx . 安装依赖 更新yum yum update -y yum -y insta ...
- Centos7 编译安装 Nginx、MariaDB、PHP
前言 本文主要大致介绍CentOS 7下编译安装Nginx.MariaDB.PHP.面向有Linux基础且爱好钻研的朋友.技艺不精,疏漏再所难免,还望指正. 环境简介: 系统: CentOS 7,最小 ...
- CentOS 6下编译安装Nginx
CentOS 6下编译安装Nginx By:老宁 一.准备make环境 yum -y install gcc gcc-c++ automake autoconf libtool make 二.准备 ...
- ubuntu14.04 nginx php编译安装,Ubuntu 14.04 编译安装 Nginx
在Ubuntu 14.04下编译安装 Nginx过程笔记. 下载源码包 nginx 地址: http://nginx.org/en/download.html 编译前先安装两个包: 直接编译安装会碰到 ...
- CentOS 6.5编译安装Nginx+MySQL+PHP
一.配置防火墙,开启80端口.3306端口,关闭SELINUX [root@Zabbix ~]# vim /etc/sysconfig/iptables -A INPUT -i lo -j ACCEP ...
- ansible-playbook 手工编译安装nginx
虽然nginx也可以通过yum安装,但是如何使用源码包安装并自定义开启一些nginx功能模块,并且通过ansible下发到被管理集群呢?下面给给位看官提供一个具体实例以供参考. 首先我们需要手工编译好 ...
最新文章
- PAT - L1-020. 帅到没朋友(裸并查集)
- python 字符串拼接_面试官让用 3 种 python 方法实现字符串拼接 ?对不起我有8种……...
- jboss 反序列化 getshell
- 一图读懂 | 2030年前碳达峰行动方案
- python字符串中某个字符修改_Python中修改字符串的四种方法
- java中isolate时间_flutter/dart里面,一个isolate一般heap多大?
- Java Servlet(一):创建工程(jdk7+tomcat7+eclipse)
- QC与IE8 、WINDOWS 7 兼容问题的解决方案
- PNG免扣(抠)素材,直接应用才是设计师友好的帮助图片
- 常见浏览器的兼容问题
- python爬虫从入门到放弃-【爬虫】python爬虫从入门到放弃
- android自定义ViewPager之——3D效果应用
- paip.提升用户体验----- 密码控件的使用
- 服务器显示AL024是什么意思,焦作台达ASD-A2-0241-M伺服驱动器出现报警代码AL024怎么维修...
- (一)MATLAB中的输入与输出
- IMU标定——椭球拟合
- 平常水题 - Atcoder 058 - C - 怪文書 / Dubious Document(字符串的处理)
- Kafka教程(三):原理及存储
- 八位彻底改变App Store的iOS开发者
- 蒙特卡洛搜索树python_蒙特卡洛树搜索最通俗入门指南
热门文章
- 蓝牙模块音频BLE数据数传串口AT指令的使用方法
- 猜数游戏,随机目标数字,直到猜中退出
- 如何在64位WIN7下安装64位的解压版mysql-5.6.37-winx64.zip
- andriod sqlite 详解转载
- .NET基础 (03)生成、部署和管理
- LightOj 1078 Basic Math
- linux下命令行的使用:使用sed命令操作文件
- tomcat6.0+mysql5.0+jdk5.0+myeclipse6.0打造JSP开发平台
- 序列化与反序列化(1)Serializable —— Java原生态方法
- 安卓APP_ 布局(6) —— ConstrainLayout约束布局(重要)