Ngigx + Tomcat configure static/dynamic separation, Server Load balancer, and ngigxtomcat
Since the company used Ngnix, I felt a little curious about Nginx, So I studied it.
My version used in windows is nginx-1.8.1:
1. Start Ngnix
Double-click nginx-1.8.1. nginx.exe in the folder. If two nginx processes exist in the task manager, the startup is successful!
2. Common Ngnix commands
Forced nginx-s stop Shutd
When deploying the project, 2 servers were used. The request was loaded with load balancing, resulting in YII2 static files (js,css ...) Reported 404, The reason is: the request for a page when a server to process, but the static resource is missing the request to the B server, B server's YII2 resource manager has not been generated in the Web\assets directory and static files.
Take a closer look at the static resource Management code for YII2: yi
Today, the teacher talked about the server architecture. Although simple, there are still some difficulties. We need to expand the architecture on this basis.
There is data synchronization during Server Load balancer. Baidu later saw the previous generation share:
Inotify + Rsync is used to implement batch synchronization and batch update of Linux Files in batches. This should be a frequent task for O M pe
In enterprise applications, Tomcat is used as an application.
Service
But tomcat, as a lightweight application server, has limited load capacity and is overwhelmed after the system is launched. At this time, people will think of clusters, unfortunately, it is inconvenient to start a cluster in previous versions.
Tomcat5.5 has made great improvements in this regard. We can first implement the tomcat5.5 cluster.
1. Configure Tomcat
1. directly extra
. Compiling and installingSetting Installation Parameters[Email protected] nginx-1.10.2]#./configure--prefix=/usr/local/nginx--with-http_ssl_moduleCompiling and installing[[email protected] nginx-1.10.2]# make[[email protected] nginx-1.10.2]# make installOpenSSL generates a test CA certificate: See Resources1.1.1.4. Modify the nginx.conf file for load balancing:Requirements: 1. User through HTTPS access, through the Nginx reverse proxy implementation
Redis/Distributed File Storage System/database storage session solves session inconsistency in the Server Load balancer cluster, redissession
Let's talk about the similarities and differences between sessions and cookies.
Session and cookie are not only stored on the server, but also stored on the client.
Although the session is stored on the server side, it also needs to match with the client. Imagine tha
/etc/hosts172.18.1.6 k8s-node-1172.18.1.7 k8s-node-2172.18.1.8 k8s-node-3172.18.1.9 k8s-node-42. Installing the ETCD Cluster2.1 K8s-node-1 operation (individual ports can be controlled by themselves)Yum-y Install etcd# Create ETCD Data Modify configuration file,/etc/etcd/etcd.conf need to modify the following parameters: etcd_name=etcd1etcd_listen_peer_urls= "/http 172.18.1.6:2380 "etcd_listen_client_urls=" http://172.18.1.6:2379,http://127.0.0.1:2379
}
Track_script {
Chk_haproxy
}
}
Mkdir-P/usr/local/haproxy/Shell
CD/usr/local/haproxy/Shell
# Create a monitoring haproxy script
VI check_haproxy.sh
#! /Bin/bash
# Auto check haprox Process
#2014-6-30
Killall-0 haproxy
If [[$? -Ne 0]; then
/Etc/init. d/keepalived stop
Fi
Chmod U + x check_haproxy.sh
Service keepalived restart
Iv. Test
Bind VIP 172.000027.200 to your domain name for testing.
1. Ping the IP address 172.20.27.200 all the time, and then
create the same program as above.// *. VBImports system
Namespace cilexampleModule cilappSub main ()Dim C as new calcResult = C. Add (10, 84)Console. writeline ("10 + 84 = {0}", result)Console. Readline ()End subEnd Module
Class calcPublic Function add (byval X as integer, byval y as integer) as integerReturn x + yEnd FunctionEnd Class
End namespace
If you look at his or her pencil code, you will find very similar, with only a few differenc
About haproxy
Provides high availability, Server Load balancer, and proxy Based on TCP and HTTP applications, and supports Virtual Hosts. It is a free, fast, and reliable solution. Haproxy is especially suitable for websites with extremely high loads, which usually require session persistence or layer-7 processing. Haproxy runs on the current hardware and supports tens of thousands of concurrent connection
Configure haproxy L7 Server Load balancer in Route 3-Based on URL address directory forwarding
● 3.1 prepare the RS server test environment
Create a test directory:For name in PHP nginx PIC; do mkdir-P/var/$ name; echo $ Name>/var/$ name/index.html; done
Configure HTTP serviceDelete any Apache configuration above (or restore httpd. conf)[Root @ ha2 conf] # cd/etc
First of all, we must acknowledge that from the perspective of this development preview, Win8 has made great breakthroughs in both technology and interface. It can be said that it fully demonstrates Microsoft's powerful desktop technology. New development tools allow almost allProgramDevelopers develop applications for Win8, from traditional C/C ++ to C # And even Web JavaScript, moreover, programs written in C # Or javascript can run on x86 and ARM hardware platforms; the concept of "content as
Nginx:nginx-1.8.0.tar.gzTomcat:apache-tomcat-8.0.0-rc10.tar.gzClient 192.168.52.40Nginx192.168.52.73Tomcat1192.168.52.65Tomcat2192.168.52.67#gzip on;Upstream Tomcat_server {Server 192.168.52.65:8080;Server 192.168.52.67:8080;Location/{root HTML;Index index.html index.htm;Proxy_pass Http://tomcat_server;}If the following error occurs Upstream Misplaced , should be placed in http inside the module but must be in Server outside the module:Nginx : [Emerg] "upstream" directive is not allowed herein/
Description = Example. NET Web API Application running on Ubuntu 3 4 [Service] 5 WorkingDirectory =/var/aspnetcore/hellomvc 6 ExecStart =/usr/bin/dotnet/var/aspnetcore/hellomvc. dll 7 Restart = always 8 RestartSec = 10 # Restart service after 10 seconds if dotnet service crashes 9 SyslogIdentifier = dotnet-example10 User = www-data11 Environment = ASPNETCORE_ENVIRONMENT = Production 12 13 [Install] 14 then getView Code
The User is changed to root. The working directory is the directory uploaded
Windows azure platform articles
This chapter describes how to create a traffic manager policy on the Windows azure Management Portal.
Log on to the Windows azure Management Portal and select "Virtual Network" --> "traffic manager" --> "policy" --> "CREATE"
In the "Create traffic manager" dialog box, modify the following:
"
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.