yum -y install zip unzip gcc gcc-c++ automake \ autoconf libtool make glibc gd-devel pcre-devel \ libmcrypt-devel mhash-devel libxslt-devel libjpeg \ libjpeg-devel libpng libpng-devel freetype \ freetype-devel libxml2 libxml2-devel zlib \ zlib-devel glibc glibc-devel glib2 glib2-devel \ bzip2 bzip2-devel ncurses ncurses-devel curl \ curl-devel e2fsprogs e2fsprogs-devel krb5 \ krb5-devel libidn libidn-devel openssl \ openssl-devel libevent libevent-devel
yum info pcre-devel
groupadd nginx useradd -s /sbin/nologin -M nginx -g nginx
cd /data/soft wget http://nginx.org/download/nginx-1.18.0.tar.gz tar -xf nginx-1.18.0.tar.gz
cd nginx-1.18.0/ ./configure \ --prefix=/data/nginx \ --user=nginx \ --group=nginx \ --with-file-aio \ --with-threads \ --with-http_addition_module \ --with-http_auth_request_module \ --with-http_dav_module \ --with-http_flv_module \ --with-http_gunzip_module \ --with-http_gzip_static_module \ --with-http_mp4_module \ --with-http_random_index_module \ --with-http_realip_module \ --with-http_secure_link_module \ --with-http_slice_module \ --with-http_ssl_module \ --with-http_stub_status_module \ --with-http_sub_module \ --with-http_v2_module \ --with-mail \ --with-mail_ssl_module \ --with-stream \ --with-stream_realip_module \ --with-stream_ssl_module \ --with-stream_ssl_preread_module make && make install
/data/nginx/sbin/nginx
vim /etc/init.d/nginx
#!/bin/bash
# chkconfig: 2345 97 25
#description nginx-server-scryt
nginx=/data/nginx/sbin/nginx
case "$1" in
start )
netstat -anlpt | grep ngin[x]
if [ $? -eq 0 ]
then
echo "nginx service is running!"
else
echo "nginx service runing!"
$nginx
fi
;;
restart)
$nginx -s reload
if [ $? -eq 0 ]
then
echo "nginx server is begin restart"
else
echo "nginx server restart"
fi
;;
stop)
$nginx -s stop
if [ $? -eq 0 ]
then
echo "nginx server is stop"
else
echo "nginx server stop,try again"
fi
;;
status)
netstat -anlpt | grep ngin[x]
if [ $? -eq 0 ]
then
echo "nginx server is running!"
else
echo "nginx server is not runing.try to restart"
fi
;;
*)
echo "Please enter (start|restart|stop|status)"
;;
esac
exit 0
chmod +x /etc/init.d/nginx
vim /etc/rc.local /etc/init.d/nginx start chkconfig --add nginx
vim /etc/profile export PATH="$PATH:/data/nginx/sbin/" source /etc/profile
你可能也喜欢————

本站已稳定运行 980 天