Nginx performs reverse proxy to achieve basic load balancing configuration. Unable to load CSS, JS or images

Source: Internet
Author: User

Load Balancing of one nginx front-end and three backend servers

My backend servers here are all static pages.

Nginx IP 192.168.1.2

Server1: 192.168.1.3

Server2: 192.168.1.4

Server3: 192.168.1.5

The basic configuration of nginx is as follows:

Worker_processes 4;

Worker_cpe_affinity 0001 0010 0100 1000

Worker_rlimit_nofile 51200;

Events {

Use epoll;

Worker_connections 51200;

}

HTTP {

Include mime. types;

Default_type application/octet-stream; # this should be noted that it is used when parsing CSS JS

Server_names_hash_bucket_size 128;

Client_header_buffer_size 32 K;

Upstream 192.168.1.2 {

Server 192.168.1.3: 80;

Server 192.168.1.4: 80;

Server 192.168.1.5: 80;

}

Server {

Listen 80;

SERVER_NAME 192.168.1.2;

Charset GBK;

Location /{

Proxy_pass http: // 192.168.1.2;

}

# Other configurations

}

} The above is the simplest and most basic configuration. I have passed the test. But note that if you encounter a problem where the backend CSS, JS, or image cannot be loaded during the test. First determine default_type application/octet-stream; then stop

Nginx can use pkill-9 nginx and then start 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.