自动安装nginx
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了自动安装nginx相关的知识,希望对你有一定的参考价值。
touch install-nginx.sh
chmod +x install-nginx.sh
vim install-nginx.sh
#/bin/bash
# auto install nginx-1.4.2
#author swh
echo -e "Nginx will be installing,\nplease wait......"
yum install -y gcc automake autoconf libtool make
yum install -y gcc gcc-c++
yum install -y pcre* zlib* openssl*
mkdir /usr/local/nginx
groupadd nginx
useradd -r nginx -g nginx -s /sbin/nologin
chown -R nginx:nginx /usr/local/nginx
wget http://nginx.org/download/nginx-1.4.2.tar.gz
tar -zxvf nginx-1.4.2.tar.gz
cd nginx-1.4.2
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module
make && make install
echo "Nginx install over,Now checking....."
/usr/local/nginx/sbin/nginx
netstat -tuplna | grep nginx
ps -ef | grep nginx
ret=$?
if [ $ret -eq 0 ]
then
echo "Nginx install sucess"
echo;echo
echo "`/usr/local/nginx/sbin/nginx -V`"
elif [ $ret -ne 0 ]
netstat -tuplna | grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 4515/nginx
[[email protected] ~]# ps -ef |grep nginx
root 4515 1 0 10:36 ? 00:00:00 nginx: master process /home/nginx/sbin/nginx
www 4518 4515 0 10:36 ? 00:00:00 nginx: worker process
root 11787 2201 0 11:24 pts/0 00:00:00 grep nginx
本文出自 “mailfile” 博客,谢绝转载!
以上是关于自动安装nginx的主要内容,如果未能解决你的问题,请参考以下文章