Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Server \ Nginx load balancing configuration (http proxy)     - Compiled version of Android Opus audio codec library method (Programming)

- PHP 5.3 New Features Detail (Linux)

- MySQL and MariaDB new master from the cluster configuration GTID (Database)

- Installation Elementary OS Freya 20 things to do (Linux)

- Java annotations entry automatically generates SQL statements (Programming)

- RMAN parameters of ARCHIVELOG DELETION (Database)

- I use the desktop environment in GNU / Linux combination tool (Linux)

- Linux_Logo - output color ANSI Linux distributions logo command-line tool (Linux)

- CentOS 6.4 Python 2.6 upgrade to 2.7 (Linux)

- Quick Install software RAID on Linux (Linux)

- Linux atomic operations and synchronization mechanisms (Programming)

- Google open source TCP team repaired the Linux kernel TCP flaw (Linux)

- Install Apache streaming media services on CentOS 6.4 (Server)

- iOS GCD multithreading simple to use (Programming)

- Linux Network Programming --epoll model Detailed principles and examples (Programming)

- About Leetcode on Binary Tree Algorithm summary (Programming)

- Using packet capture libpcap be reconciliation package in Ubuntu 14.04 64 bits (Linux)

- How to choose the first programming language based on the life you want (Programming)

- Oracle 11g modify MEMORY_TARGET (Database)

- Oracle RMAN repair logical bad blocks (Database)

 
         
  Nginx load balancing configuration (http proxy)
     
  Add Date : 2018-11-21      
         
         
         
 

 

Nginx is a performance-oriented design HTTP server, compared to Apache, lighttpd has possession of less memory, high stability advantages. With the old version (< = 2.2) of different Apache, nginx is not a thread-per-client design model, but full use of asynchronous logic, reducing the scheduling overhead context, the concurrent service ability. Overall modular design, the module has a wealth of third-party libraries and library modules, flexible configuration. In the Linux operating system, nginx use epoll event model, thanks to this, nginx under the Linux operating system, very high efficiency. Meanwhile Nginx uses an efficient event model similar to epoll kqueue on OpenBSD or FreeBSD operating system. nginx is also a high-performance HTTP server and reverse proxy, also a IMAP / POP3 / SMTP proxy server. Nginx already because of its stability, rich feature set, simple configuration, and low resource consumption and the famous.

 

Today my topic it is mainly Nginx load balancing test, the steps do record it as a learning notes, can also give you the next reference.

 

1. Experimental environment

 

System version: CentOS release 5.9 (Final) x86 32 Wei

 

nginx version: 1.2.8
nginx load balancing location: 125.208.14.177 80 port
web1 125.208.12.56:80 port
web2 218.78.186.162:8090 port
web3 125.208.14.177:8080 port

 

Here it, I use on web_1 and web_2 system comes with apache, required to change the listening port ok, of course, you can also install nginx, that you can figure it out, I 125.208.14.177 on installation nginx, used as a load balancer and web servers, load balancing using port 80, and the web service uses port 8080.

 

2: Profiles

 

[root @ host-192-168-2-177 conf] # more nginx.conf

 

worker_processes 1;

 

events {

 

    worker_connections 1024;

 

}

 

 
 
 
 
http {

 

 
  upstream site {

 

                server 125.208.12.56:80;

 

                server 218.78.186.162:8090;

 

                server 125.208.14.177:8080;

 

             }
 
 
    include mime.types;

 

    default_type application / octet-stream;

 

    sendfile on;

 

    keepalive_timeout 65;

 

 
 
 
    server {

 

        listen 80;

 

        server_name localhost;

 

        location / {

 

            proxy_pass http: // site;
            root / var / www / html;

 

            index index.php;

 

       }

 

        error_page 500 502 503 504 /50x.html;

 

        location = /50x.html {

 

            root html;

 

       }

 

       

 

        location ~ .php $ {

 

            root / var / www / html;

 

            fastcgi_pass 127.0.0.1:9000;

 

            fastcgi_index index.php;

 

            fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;

 

            include fastcgi_params;

 

       }

 

   }

 

   

 

 
      server {

 

        listen 8080;

 

        server_name localhost2;

 

        location / {

 

            root / var / www / html2;

 

            index index.php;

 

       }

 

        error_page 500 502 503 504 /50x.html;

 

        location = /50x.html {

 

            root html;

 

       }

 

 

 

        location ~ .php $ {

 

            root / var / www / html2;

 

            fastcgi_pass 127.0.0.1:9000;

 

            fastcgi_index index.php;

 

            fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;

 

            include fastcgi_params;

 

       }

 

   }

 

   

 

}

 

3: Test

 

[root @ host-192-168-2-177 conf] # curl 125.208.14.177

 

404 Not Found

 


404 Not Found

 

----------------------------------------------- ---------------------------------
nginx

 


[root @ host-192-168-2-177 conf] # curl 125.208.14.177
1234
[root @ host-192-168-2-177 conf] # curl 125.208.14.177
this dir is / var / www / html2

 

--- successful visit polling

     
         
         
         
  More:      
 
- Difference in MySQL VARCHAR and CHAR data format (Database)
- CentOS 6.6 running level (Linux)
- Java programmers talk about those advanced knowledge and direction (Programming)
- Access clipboard content across multiple vim instances in a terminal (Linux)
- Struts2 configure a static resource files without Struts processing (regular match) (Programming)
- Oracle 11g upgrade PSU detailed steps (Database)
- iptables allow only specific ip address to access the specified port (Linux)
- CentOS 7 update source - the use of domestic sources 163 yum (Linux)
- Linux supports serial output method (Linux)
- Will Laravel become the most successful PHP framework? (Programming)
- PuTTY Xming achieve the X11 forwarding ssh (Server)
- Log4Net (Linux)
- Use the Find command to help you find those files that need to be cleaned (Linux)
- MogileFS system installation configuration example (Server)
- ARP spoofing prevent Linux environment LAN (Linux)
- MySQL TIMESTAMP and DATETIME (Database)
- Iptables use examples (Linux)
- Struts2 interceptor simulation (Programming)
- HAproxy let IP recording back-end RS (Server)
- Linux novice common commands (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.