码迷,mamicode.com
首页 > 系统相关 > 详细

linux一键安装nginx脚本

时间:2018-11-08 19:47:48      阅读:350      评论:0      收藏:0      [点我收藏+]

标签:ble   useradd   led   passwd   oca   一键   ++   pass   table   

#!/bin/sh
echo "----------------------------------start install nginx -----------------------------"
yum install -y gcc-c++ zlib zlib-devel openssl openssl--devel pcre pcre-devel
if [ ‘grep "nginx" /etc/passwd | wc -l‘ ]; then
echo "adding user nginx"
groupadd nginx
useradd -s /sbin/nologin -M -g nginx nginx
else
echo "user nginx exsits"
fi

echo "-----------------------------------downloading nginx-------------------------------"
wget http://nginx.org/download/nginx-1.9.5.tar.gz
tar -xvf nginx-1.9.5.tar.gz
cd nginx-1.9.5

echo "------------------------------------configuring nginx,plz wait----------------------"
./configure --prefix=/usr/local/nginx 

if [ $? -ne 0 ];then
echo "configure failed ,please check it out!"
else
echo "make nginx, please wait for 20 minutes"
make
fi

if [ $? -ne 0 ];then
echo "make failed ,please check it out!"
else
echo "install nginx, please wait for 20 minutes"
make install
fi

chown -R nginx.nginx /usr/local/nginx
ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1
/usr/local/nginx/sbin/nginx
iptables -I INPUT 3 -s 0.0.0.0/0 -p tcp --dport 80 -j ACCEPT

linux一键安装nginx脚本

标签:ble   useradd   led   passwd   oca   一键   ++   pass   table   

原文地址:https://www.cnblogs.com/henrylinux/p/9931302.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!