Linux under Nginx automatic deployment script

Source: Internet
Author: User

Make sure the system can use the Yum source to access the extranet.

Variable Nginx_path modify nginx installation path, default is/opt/nginx

Variable nginx_version Modify the installation version of Nginx, default to 1.10.0


#!/bin/bash

# The Nginx installation script automatically

# AUTHOR:STARTUPPP


location=$ (PWD)

Nginx_path=/opt/nginx

nginx_version=1.10.0


Echo-e "\ n-----------------------------------------"

echo "is performing installation, please wait a moment"

Groupadd nginx &>/dev/null

Useradd-m-s/sbin/nologin-g nginx &>/dev/null


Echo-e "is downloading, please wait\n"

Yum-y install wget gcc gcc-c++ automake autoconf libtool make pcre* zlib* openssl* lsof &>/dev/null

#wget http://118.144.79.137/download/nginx-1.10.0.tar.gz &>/dev/null

wget http://nginx.org/download/nginx-$NGINX _version.tar.gz


Echo-e "is installation, please wait\n"

Tar zxf nginx-$NGINX _version.tar.gz

CD nginx-$NGINX _version

./configure--prefix= $NGINX _path--user=nginx--group=nginx--with-http_ssl_module--with-http_realip_module &>/dev/null

Make &>/dev/null

Make install &>/dev/null


If [$?-eq 0]

Then

Echo-e "\nnginx installation succeeded \ n"

Else

Echo-e "\nnginx installation failed \ n"

echo Error && exit 10

Fi


Cd/opt

if [!-D Tools]

Then

mkdir Tools

Fi


Netstat-npult|grep Nginx

If [$?-eq 0]

Then

Echo-e "\n\n80 port is already occupied \ n Please modify Nginx port"

Else

$NGINX _path/sbin/nginx

Echo-e "\n\nnginx started \ n Listening port is 80"

ECHO-E "NGINX installation path is $nginx_path"

Fi


CD $LOCATION

MV nginx-1.10.0.tar.gz Nginx-1.10.0/opt/tools &>/dev/null

Echo-e "\ n-----------------------------------------"


650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/8A/0B/wKiom1gkVMSCozqkAAEaDuSd1qA434.jpg-wh_500x0-wm_3 -wmp_4-s_4194298697.jpg "title=" C830.tmp.jpg "alt=" Wkiom1gkvmscozqkaaeadusd1qa434.jpg-wh_50 "/>

This article is from the "STARTUPPP" blog, make sure to keep this source http://startuppp.blog.51cto.com/11847460/1871593

Linux under Nginx automatic deployment script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.