The following is a load balancer configuration for nginx under window.
Need you to run two tomcat on your computer. A 8080, a 9080.
An Nginx server is required.
Need to modify host for this machine
Note: We do not configure this configuration in the Nginx main configuration file, because in order to better extensibility, to prevent pollution of the original configuration file, we use the method of reference, learn spring children's shoes should know. It's not much to say.
This is mainly about Nginx configuration. As for how to run two tomcat on a computer can find me related blog.
Here, the nginx.conf master configuration file requires only one line of code, and the reference can be as follows:
http { include vhost/*. conf; Include mime.types; Default_type Application/octet-stream; Omitted }
Add an include vhost/*.conf to the HTTP node; This sentence means creating a new Vhost directory under the current directory, and then create a configuration file with a suffix of conf.
Write mmall.conf below
upstream www.mmall.com{ server www.mmall.com:8080; Server www.mmall.com:9080 weight=1;} server { a; server_name www.mmall.com; AutoIndex on; Access_log logs/mmall.log combined; Index index.html index.jsp index.php; / { proxy_pass http://www.mmall.com; Add_header Access-control-allow-origin *; }
Explain the pits that the above code may encounter. This referenced configuration file requires only the write server node that does not require additional nodes. For the first time, I copied all the nginx.conf directly into the past. Results. Error.
There's nothing to talk about. Polling needs to be tried several times at least 30 times to see the effect because I checked the ~~~~~~~~~~~~~~~~ wipe
We need to know the Nginx three main commands:
--S reload (the configuration file needs to be executed after it has been modified)
Implementation of load Balancing simple configuration-----Weights for window Nginx