标签:col file enter sys check page efi fir mkdir
#!/bin/bash
auto config nginx server
#by author www.jfedu.net
#2018年5月14日17:25:52
N_PAR="vim lrzsz perl perl-devel libxml2 libxml2-devel ncurses ncurses-devel gd gd-deve
l wget gcc gcc-c++ pcre pcre-devel ntp ntpdate openssl openssl-devel"
N_URL="http://nginx.org/download/nginx-1.14.0.tar.gz"
N_DIR="nginx-1.14.0.tar.gz"
N_PATH="nginx-1.14.0"
N_PREFIX="/usr/local/nginx"
N_VHOST=$1
if [ -d $N_PREFIX ];then
echo -e "\033[32mThe nginx server already installd ,please exit.\033[0m"
read -p "Enter the number of installd users:" lists
service iptables stop
setenforce 0
systemctl stop firewalld
ps -ef |grep nginx
mkdir -p $N_PREFIX/conf/domains
mkdir -p $N_PREFIX/html/$lists
cat >$N_PREFIX/html/$lists/index.html<<EOF
<html>
<h1> The first test nginx page.<h1>
<h1> The www.$lists.com test page.<h1>
<hr color="red">
</html>
EOF
cat >$N_PREFIX/conf/nginx.conf<<EOF
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
include domains/*;
}
EOF
cat >$N_PREFIX/conf/domains/www.$lists\.com<<EOF
server {
listen 80;
server_name www.$lists.com;
location / {
root html/$lists;
index index.html index.htm;
}
}
EOF
$N_PREFIX/sbin/nginx -t
if [ $? -eq 0 ];then
pkill nginx
$N_PREFIX/sbin/nginx
else
echo -e "\033[32m Please check nginx config file\033[0m"
exit
fi
else
echo -e "\033[32m Please install nginx server \033[0m"
yum install -y $N_PAR
ntpdate 1.cn.pool.ntp.org
cd /usr/src
wget -c $N_URL
tar xzf $N_DIR
cd $N_PATH
./configure --prefix=$N_PREFIX --with-http_ssl_module --with-pcre
if [ $? -eq 0 ];then
make && make install
echo -e "\033[32m The nginx server install successfully.\033[0m"
else
echo -e "\033[32m The nginx server install failed,please check\033[0m"
exit
fi
ln -s $N_PREFIX/sbin/nginx /usr/local/sbin
$N_PREFIX/sbin/nginx -t
if [ $? -eq 0 ];then
$N_PREFIX/sbin/nginx -s reload
else
echo -e "\033[32m Please check nginx config file\033[0m"
exit
fi
read -p "Enter the number of installd users:" lists
service iptables stop
setenforce 0
systemctl stop firewalld
ps -ef |grep nginx
mkdir -p $N_PREFIX/conf/domains
mkdir -p $N_PREFIX/html/$lists
cat >$N_PREFIX/html/$lists/index.html<<EOF
<html>
<h1> The first test nginx page.<h1>
<h1> The www.$lists.com test page.<h1>
<hr color="red">
</html>
EOF
cat >$N_PREFIX/conf/nginx.conf<<EOF
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
include domains/*;
}
EOF
cat >$N_PREFIX/conf/domains/www.$lists\.com<<EOF
server {
listen 80;
server_name www.$lists.com;
location / {
root html/$lists;
index index.html index.htm;
}
}
EOF
$N_PREFIX/sbin/nginx -t
if [ $? -eq 0 ];then
pkill nginx
$N_PREFIX/sbin/nginx
else
echo -e "\033[32m Please check nginx config file\033[0m"
exit
fi
fi
标签:col file enter sys check page efi fir mkdir
原文地址:https://www.cnblogs.com/jpfss/p/9717303.html