In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Goal: one-click deployment of nginx
Software: tengine-2.1.2.tar.gz (a branch of nginx)
Note: only applicable to CentOS 6 64-bit systems, with nginx configuration files for online production environment
Package: link: http://pan.baidu.com/s/1jIyZrRS password: q9uu
[root@salt-master home] # cat nginx.sh
#! / bin/bash
#
# applicable version of CentOS 6 64 bit
# 2017.5.11
. / etc/init.d/functions
Dir=/root/test
User=www
Group=www
Del_dir () {
Read-p "need to delete ${dir} whether to delete [Y | y dir N | n]:" del
Case $del in
Y | y)
Rm-rf $dir
Mkdir $dir
Cd $dir
N | n)
Echo "installation termination"
Exit 7
*)
Echo "Please enter the correct value"
Exit 8
Esac
}
[!-d $dir] & & {
Mkdir $dir
Cd $dir
} | | del_dir
Wget http://172.2.0.68/tengine-2.1.2.tar.gz
Wget http://172.2.0.68/nginx.txt
Wget http://172.2.0.68/pcre-8.31.tar.bz2
Yum-y install gcc gcc-c++ pcre-devel openssl-devel
[! `grep $group / etc/group & > / dev/ null`] & & {
Groupadd www
}
[! `grep $user / etc/passwd & > / dev/ null`] & & {
Useradd-M-g www-s / sbin/nologin www
}
Echo "# install pcre##"
Sleep 4
Tar-jxvf pcre-8.31.tar.bz2
[$?-eq 0] & & cd pcre-8.31 | | exit 6
. / configure-- prefix=/usr/local/pcre
Make & & make install
# #
Cd..
[- e $dir/tengine-2.1.2.tar.gz] & & {
Tar-zxvf tengine-2.1.2.tar.gz
Cd tengine-2.1.2
}
/ configure-- user=www-- group=www-- prefix=/mnt/tengine/tengine-2.1.2-- with-http_stub_status_module-- with-pcre-- with-http_ssl_module-- with-http_gzip_static_module-- with-http_realip_module-- with-http_upstream_check_module-- with-ipv6
[$?-eq 0] & & {
Make & & make install
} | | {
Echo "compilation error"
Exit 7
}
[- f $dir/nginx.txt] & & {
Mv / mnt/tengine/tengine-2.1.2/conf/nginx.conf / mnt/tengine/tengine-2.1.2/conf/nginx.confbak
Cat $dir/nginx.txt > / mnt/tengine/tengine-2.1.2/conf/nginx.conf
} | | {
Echo "configuration file is entered incorrectly, please check the configuration file nginx.conf"
Exit 5
}
Echo "# start Service #"
/ mnt/tengine/tengine-2.1.2/sbin/nginx-t
[$?-eq 0] & & {
/ mnt/tengine/tengine-2.1.2/sbin/nginx
} | | {
Echo "failed to start service"
Exit 8
}
#
[root@linux-node8 html] # cat nginx.txt
User www www
Worker_processes 1
Pid / mnt/tengine/tengine-2.1.2/logs/nginx.pid
Worker_rlimit_nofile 65535
Events {
Use epoll
Worker_connections 4096
}
Http {
Include mime.types
Default_type application/octet-stream
# charset utf-8
Access_log off
Error_log logs/error.log notice
Log_format main'$remote_addr-$remote_user [$time_local] "$request"'
'$status $body_bytes_sent "$http_referer"'
'"$http_user_agent"$http_x_forwarded_for" $request_time "'
Server_names_hash_bucket_size 128
Client_header_buffer_size 32k
Large_client_header_buffers 4 32k
Client_max_body_size 300m
Sendfile on
Tcp_nopush on
Keepalive_timeout 65
Tcp_nodelay on
Server_tokens off
Client_body_buffer_size 512k
Proxy_connect_timeout 5
Proxy_read_timeout 60
Proxy_send_timeout 5
Proxy_buffer_size 16k
Proxy_buffers 4 64k
Proxy_busy_buffers_size 128k
Proxy_temp_file_write_size 128k
Gzip on
Gzip_min_length 1k
Gzip_buffers 4 16k
Gzip_http_version 1.1
Gzip_comp_level 2
Gzip_types text/plain application/x-javascript text/css application/xml
Gzip_vary on
Server {
Listen 80
Server_name localhost
Location / {
Root html
Index index.html index.htm
}
Error_page 500 502 503 504 / 50x.html
Location = / 50x.html {
Root html
}
}
Upstream backend_server {
Ip_hash
Server 192.168.1.10:80 max_fails=2 fail_timeout=30s
Server 192.168.1.20:80 max_fails=2 fail_timeout=30s
}
Server {
Listen 80
Server_name www.abc.com
Server_name abc.com
Server_name testindex.abc.com
Location / {
Proxy_redirect off
# proxy_next_upstream http_502 http_504 error timeout invalid_header
Proxy_set_header Host $host
Proxy_set_header X-Real-IP $remote_addr
Proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
Proxy_pass http://backend_server;
}
}
Upstream sqzone_api {
Ip_hash
Server 192.168.0.10:80 max_fails=2 fail_timeout=30s
Server 192.168.0.20:80 max_fails=2 fail_timeout=30s
}
Server {
Listen 80
Server_name sqZone.test.com
Server_name sqapi.test.com
Server_name sqapiby.test.com
Server_name sqapiby1.test.com
Server_name sqapitixing.test.com
Server_name sqapitixingby.test.com
Server_name sqapitixingby1.test.com
Location / {
Proxy_redirect off
Proxy_set_header Host $host
Proxy_set_header X-Real-IP $remote_addr
Proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
Proxy_pass http://sqzone_api;
}
}
}
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.