In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to install Web server Tengine under CentOS". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to install Web server Tengine under CentOS".
Note: the server environment is centos
I. brief introduction
Tengine is a web server project initiated by Taobao. On the basis of nginx, it adds a lot of advanced functions and features to meet the needs of high-volume websites. The performance and stability of tengine have been well tested in large websites such as Taobao and Tmall Mall. Its ultimate goal is to create an efficient, stable, secure and easy-to-use web platform.
Since December 2011, tengine has become an open source project, and the tengine team is actively developing and maintaining it. The core members of the tengine team come from Internet companies such as Taobao and Sogou. Tengine is the result of community cooperation, and we welcome all of you to participate and contribute to it.
2. Characteristics
Inherits all the features of nginx-1.2.9 and is 100% compatible with nginx configuration
Dynamic module loading (dso) support. Adding a module eliminates the need to recompile the entire tengine
Input filter mechanism support. It is more convenient to write web application firewall by using this mechanism.
Dynamic scripting language lua support. The extension is very efficient and simple.
Support for pipe and syslog (local and remote) logs and log sampling
An access request that combines multiple css and javascript files into a single request
More powerful load balancing capabilities, including consistency hash module and session persistence module. It can also actively check the health of the back-end server and automatically go online and offline according to the server status.
Automatically set the number of processes and binding cpu affinity according to the number of cpu
Monitor the load and resource consumption of the system to protect the system
Display error messages that are more friendly to operators, making it easy to locate error machines
More powerful anti-attack (access speed limit) module
More convenient command line parameters, such as listing compiled modules, supported instructions, etc.
You can set the expiration time according to the type of access file
III. Installation
1.yum installation
Yum installation is relatively simple, after configuring the source, you can directly yum install.
① configure a third-party yum source (there is no nginx package in the default source for centos)
The copy code is as follows:
Yum install wget # install download tool wget
Wget http://www.atomicorp.com/installers/atomic # download atomic yum feed
Sh. / atomic # installation
Yum check-update # updates the yum package
② installation configuration
The copy code is as follows:
Yum install nginx # install nginx, according to the prompts, enter y to install successfully
Service nginx start # Startup
Chkconfig nginx on # is set to boot
/ etc/init.d/nginx restart # restart
Rm-rf / usr/share/nginx/html/* # remove the ngin default test page
two。 Source code compilation and installation
The source code installation is a little more complicated, and there are some related dependent packages that need to be compiled separately
The source code installation can choose either the original nginx or the modified tengine on Taobao. It is recommended that tengin,tengine is fully compatible with nginx and adds many new features, which are suitable for increasingly complex business expansion.
Tengine official website: http://tengine.taobao.org/
① first installs pcre to support pseudo-static of nginx
The copy code is as follows:
# cd / usr/local/src
# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.21.tar.gz
# tar zxvf pcre-8.21.tar.gz
# mkdir / usr/local/pcre # create installation directory
# cd pcre-8.21
#. / configure-- prefix=/usr/local/pcre # configuration
# make
# make install
② install tengine
The copy code is as follows:
# cd / usr/local/src
# wget http://tengine.taobao.org/download/tengine-1.4.2.tar.gz
# tar zxvf tengine-1.4.2.tar.gz
# cd tengine
#. / configure-prefix=/usr/local/nginx-with-http_stub_status_module-with-pcre=/usr/local/src/pcre-8.21
# make
# make install
# / usr/local/nginx/sbin/nginx # start nginx
# chown nobody.nobody-r / usr/local/nginx/html
# chmod 700-r / usr/local/nginx/html
Note:-- with-pcre=/usr/local/src/pcre-8.21 points to the path to which the source package is decompressed, not the path to be installed, otherwise an error will be reported.
③ setting tengine boot
The copy code is as follows:
# vi / etc/rc.d/init.d/nginx # Edit startup file to add the following
#! / bin/bash
# tengine startup script# processname: nginx
# pidfile: / var/run/nginx.pid
# config: / usr/local/nginx/conf/nginx.conf
Nginxd=/usr/local/nginx/sbin/nginx
Nginx_config=/usr/local/nginx/conf/nginx.conf
Nginx_pid=/usr/local/nginx/logs/nginx.pid
Retval=0
Prog= "nginx"
# source function library.
. / etc/rc.d/init.d/functions
# source networking configuration.
. / etc/sysconfig/network
# check that networking is up.
[${networking} = "no"] & & exit 0
[- x $nginxd] | | exit 0
# start nginx daemons functions.
Start () {
If [- e $nginx_pid]; then
Echo "tengine already running...."
Exit 1
Fi
Echo-n $"starting $prog:"
Daemon $nginxd-c ${nginx_config}
Retval=$?
Echo
[$retval = 0] & & touch / var/lock/subsys/nginx
Return $retval
}
# stop nginx daemons functions.
Stop () {
Echo-n $"stopping $prog:"
Killproc $nginxd
Retval=$?
Echo
[$retval = 0] & & rm-f / var/lock/subsys/nginx / usr/local/nginx/logs/nginx.pid
}
Reload () {
Echo-n $"reloading $prog:"
# kill-hup `cat ${nginx_pid} `
Killproc $nginxd-hup
Retval=$?
Echo
}
# see how we were called.
Case "$1" in
Start)
Start
Stop)
Stop
Reload)
Reload
Restart)
Stop
Start
Status)
Status $prog
Retval=$?
*)
Echo $"usage: $prog {start | stop | restart | reload | status | help}"
Exit 1
Esac
Exit $retval
Save exit
The copy code is as follows:
# chmod 775 / etc/rc.d/init.d/nginx # Grant file execution permissions
# chkconfig nginx on # set boot
# / etc/rc.d/init.d/nginx restart
At this point, the nginx installation is complete. Here's why you use Taobao's tengine:
1. Inherits all the features of nginx and is 100% compatible with nginx configuration
two。 Dynamic module loading (dso) support. Adding a module eliminates the need to recompile the entire tengine
3. Input filter mechanism support. It is more convenient to write web application firewall by using this mechanism.
4. Dynamic scripting language lua support. The extension is very efficient and simple.
5. Support for pipe and syslog (local and remote) logs and log sampling
6. An access request that combines multiple css and javascript files into a single request
IV. Success page
After installing and launching tengine, the browser enters the ip address and the following figure shows that the installation is successful.
V. matters needing attention
1.-with-openssl=/usr/local/src/openssl-1.0.1e may make errors in this step. Note:-with-openssl=/usr/local/src/openssl-1.0.1e points to the path where the source code package is decompressed, not the path of installation, otherwise it will report an error, download and decompress the source code package, as follows:
Cd / usr/local/src
Wget http://www.openssl.org/source/openssl-1.0.1e.tar.gz
Tar zxvf openssl-1.0.1e
Then re-perform the tengine installation.
Thank you for reading, the above is the content of "how to install Web server Tengine under CentOS". After the study of this article, I believe you have a deeper understanding of how to install Web server Tengine under CentOS. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.