Implementation of load Balancing simple configuration-----Weights for window Nginx

Source: Internet
Author: User
Tags nginx server

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

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.