1. note: My Nginx version is 0.7.63 and is installed in/usr/local/nginx. The default port is 80, the Nginx startup, shutdown, restart, and reload configuration files are rewritten and put under/usr/local/nginx/sbin/, named nginxbak. sh.
Resin uses 3.1.10, installed in/usr/local/resin-3.1.10, and port 8081.
Tomcat is installed in/usr/local/apache-tomcat-6.0.29 and the port is set to 8080.
2. Create a simple web project named NginxTest
Index. jsp The content in is to print a sentence, to distinguish which backend server is accessed by the request,
The difference in a statement is the server's word recognition.
3.Set NginxTest The project is uploaded to the virtual server and deployed to the corresponding backend server. Their configurations are as follows:
Tomcat:
Resin:
Modify Hosts File:
192.168.1.86 nginx.digu.com
Start separately Tomcat (startup. sh) And Resin (httpd. sh start) , In the browser to check whether it is accessible:
4.SetTomcat , Resin As Nginx Backend server, configure a simple server cluster to demonstrate its load balancing situation.
Nginx The configuration file is as follows:
- User root;
- Worker_processes1;
-
- Error_log logs/error. log;
- # Error_log logs/stdout. log notice;
- # Error_log logs/stdout. log info;
-
- Pid logs/nginx. pid;
-
-
- Events {
- Use epoll;
- Worker_connections1024;
- }
-
-
- Http {
- Include mime. types;
- Default_type application/octet-stream;
-
- Sendfile on;
- # Tcp_nopush on;
-
- # Keepalive_timeout0