Official link (see Metaphysics for download speed):
http://nginx.org/en/download.html
Download the windows version, after decompression, enter the Nginx installation location
Start
start Nginx
a command line flashes (not an error)
Browser access localhost
The page
Nginx configuration is successful. (If it is unsuccessful, it may be that port 80 is occupied. Enter cmd and type netstat -ano | findstr '80' to view the process using port 80, and then try to kill it. If it does not work, try another port honestly. First Times, I do n’t know where to go, I changed to port 81)
Then find a tomcat to extract it, and then make a copy
Named *** 001 and *** 002 respectively to modify the two tomcat port numbers,
eg .: 18080 and 28080 respectively to
modify three ports for each tomcat (in order to distinguish tomcat, you can modify the index.jsp in the root path File )
Then start separately, try to access, and recheck if there is a problem.
Then modify the nginx.conf file in the conf under the Nginx directory.
worker_processes 1 ; #The number of worker processes, generally consistent with the number of CPU cores of the computer events { worker_connections 1024 ; #Maximum number of connections for a single process (Maximum number of connections = number of connections * number of processes) } http { include mime.types; #File extension and file type mapping table default_type application / octet- stream; #default file type sendfile on; #Enable efficient file transfer mode, the sendfile instruction specifies whether nginx calls the sendfile function to output the file, set to on for ordinary applications, if it is used for downloading and other application disk IO heavy-load applications, it can be set to off to balance the disk With network I / O processing speed, reduce system load. Note: If the picture is not displayed properly, change this to off. keepalive_timeout 65 ; #Long connection timeout time, unit is second gzip on; #Enable Gizp compression #Server cluster upstream localTomcat {#server cluster name server 127.0 . 0.1 : 18080 weight = 1 ; #Server configuration weight means weight. The greater the weight, the greater the probability of allocation. server 127.0.0.1:28080 weight=2; } #Current Nginx configuration server { listen 80 ; #Monitor port 80, can be changed to other ports server_name localhost; ############## The domain name of the current service location / { proxy_pass http://localTomcat; proxy_redirect default; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
Use. \ Nginx -s reload to make the modified configuration file take effect.
Then restart to visit nginx, you will find the tomcat page appears. Refresh, different tomcat appears.
The test was successful here.