In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Benefits and Functions of NGINX
nginx is a high-performance HTTP and reverse proxy server, as well as an IMAP / POP3 / SMTP proxy server. It mainly has the following advantages:
High concurrent connections: The official test can support 50,000 concurrent connections, and in the actual production environment, it can run to 20,000 to 30,000 concurrent connections.
Less memory consumption: Under 30,000 concurrent connections, the 10 Nginx processes opened consume only 150M (15M * 10 = 150M).
The configuration file is simple: the style is as easy to understand as the program.
Low cost: Nginx is open source software and can be used for free. However, purchasing hardware Load Balancer switches such as F5 BIG-IP and NetScaler requires more than 100,000 to hundreds of thousands of RMB.
Support rewriting rules: HTTP requests can be divided into different host server groups according to different domain names and URLs.
Built-in health check: If one of Nginx Proxy's previous Web servers goes down, it will not affect front-end access.
Bandwidth saving: GZIP compression is supported, and headers cached locally in browsers can be added.
High stability: for reverse agents, the probability of downtime is minimal
Because nginx's performance is very good, many large companies in China are using it, and the main reason is that nginx is open source and free. In addition to the various functions described above, the project mainly uses nginx to implement the following three functions:
static separation
reverse proxy
Load Balancer www.daiqiyang.com
Web pages, image cache
13.1.2 nginx Load Balancer has five main strategies
Minimum (minimum) Each request is assigned to a different server in chronological order, and if the server is lowered, it can be automatically eliminated.
weight Specifies a predetermined probability that weight is proportional to the access ratio and is used to predict uneven server performance.
ip_hash Each request is allocated according to the hash result of the access ip, so that each visitor has fixed access to a host server, which can solve the problem of the session.
Fair assigns requests based on server response time, with short response times given priority.
url_hash (third party) distributes requests by accessing the hash result of the url so that each URL is directed to the same drop server, making it more efficient when the server is cached.
install Nginx
yum -y install gcc gcc-c ++ pcre-devel openssl-devel openssl wget
wget http://nginx.org/download/nginx-1.12.2.tar.gz
tar -zxvf nginx-1.12.2.tar.gz
cd nginx-1.12.2
./ configure --prefix = / usr / local / nginx
make
be installed
Install Tomcat
Install jdk environment and test
[root@ c6s02 ~]# tail -5 /etc/profile
####java_env####
export JAVA_HOME=/usr/local/jdk1.8.0_60
export PATH=JAVAHOME/bin:
JAVAHOME/bin:JAVA_HOME/jre/bin:$PATH
export CLASSPATH=.CLASSPATH:
CLASSPATH:JAVA_HOME/lib:JAVAHOME/jre/lib:
JAVAHOME/jre/lib:JAVA_HOME/lib/tools.jar
source /etc/profile
[root@ c6s02 ~]# java -version
java version "1.8.0_60"
Java™ SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot™ 64-Bit Server VM (build 25.60-b23, mixed mode)
Install tomcat (two subsystems)
tar -zxvf apache-tomcat-7.0.47.tar.gz
#New tomcat01 project
mkdir -p /opt/tomcat01
cp -a apache-tomcat-7.0.47/* /opt/tomcat01/
#Create tomcat02 project, and modify three ports to 18005, 18080, 18009
mkdir -p /opt/tomcat021
cp -a apache-tomcat-7.0.47/* /opt/tomcat02/
#Manually create test pages and test
echo 'this is tomcat01' >/opt/tomcat01/webapps/ROOT/index.jsp
echo 'this is tomcat02' >/opt/tomcat02/webapps/ROOT/index.jsp
curl 10.0.0.22:8080/index.jsp
curl 10.0.0.22:18080/index.jsp
By combining Nginx and Tomcat
Install nginx and modify the Nignx configuration file
vim /usr/local/nginx/conf/nginx.conf
Add to HTTP module:
upstream tomcat { #define server group tomcat
server 10.0.0.22:8080; #Tomcat server after definition
server 10.0.0.22:18080;
}
Add to the server module:
location ~ .jsp$ { #URL regular match, matches all URLs at the end of jsp
proxy_pass http://tomcat; #proxy_pass Reverse proxy parameter, reverse proxy matching request to tomcat server group!
}
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.