NGINX1.10 compilation installation

Compile and install nginx1.10 (reproduced from: https://blog.csdn.net/goghdian/article/details/80264861)

Install dependent packages
yum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel p>

cd /usr/local/src
wget http:// nginx.org/download/nginx-1.10.3.tar.gz
tar -zxvf nginx-1.10.3.tar.gz
cd nginx-1.10.3
Compile and install< br>./configure –prefix=/usr/local/nginx –pid-path=/var/run/nginx/nginx.pid –lock-path= /var/lock/nginx.lock –error-log-path=/var/log/nginx/error.log –http-log-path=/var/log/nginx/access.log –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/fastcgi –http-uwsgi-temp-path =/var/tmp/nginx/uwsgi –http-scgi-temp-path=/var/tmp/nginx/scgi –with-http_ssl_module
Pay attention to the error message
make
make install< /span>
echo $?
Create nginx.pid directory span>
cd /var/tmp/
mkdir /var/tmp/ nginx

nginx does not have a default startup script
Create nginx startup script
vim /etc/init.d/nginx

#!/bin/bash
#chkconfig:-30 21
# description: http service.
# Source Function Library
. /etc/init.d/functions
# Ngi nx Settings

NGINX_SBIN=”/usr/local/nginx/sbin/nginx”
NGINX_CONF=”/usr/local/nginx/conf/nginx.conf”
NGINX_PID=”/ var/run/nginx/nginx.pid”
RETVAL=0
prog=”Nginx”

start() {
echo -n $”Starting $prog: “
mkdir -p /dev/shm/nginx_temp< br> daemon $NGINX_SBIN -c $NGINX_CONF
RETVAL=$?
echo
return $RETVAL
}

stop() {
echo -n $”Stopping $prog: “
killproc -p $NGINX_PID $NGINX_SBIN -TERM
rm -rf /dev/shm/nginx_temp
RETVAL=$?
echo
return $RETVAL
}

reload(){
echo -n $”Reloading $prog: “
killproc -p $NGINX_PID $NGINX_SBIN -HUP
RETVAL=$?
echo
return $RETVAL
}

restart(){
stop
start
}
configtest(){
$NGINX_SBIN -c $NGINX_CONF -t
return 0
}

case “$1” in
start)
start
; ;
stop)
stop
;;
reload)
reload
;;
restart)
restart
;;
configtest)
configtest
;;
*)
echo $”Usage: $0 {start|stop|reload|restart|configtest}”
RETVAL=1
esac
exit $RETVAL

< span style="font-size: 15px;">Change permissions
chmod 755 /etc/init.d/nginx
chkconfig –add nginx
chkconfig nginx on

service nginx start|stop|restart|reload|configtest
netstat -lnp

Leave a Comment

Your email address will not be published.