Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Server \ Nginx load balancing configuration (http proxy)     - Timing Nginx logs cut and remove the log records of the specified number of days before (Server)

- Circular list of Java programming (Programming)

- Overall Physical Migration of Oracle Database with (Database)

- JavaScript common functions summary (Programming)

- Android code performance optimization tips (Programming)

- Oracle 11g logical standby achieve BI needs (Database)

- Java Graphics2D Paint (Programming)

- Install Git on CentOS (Linux)

- Linux Network Programming - non-blocking program (Programming)

- Linux network security backdoor technology and advanced skill practice (Linux)

- CentOS / Linux NIC set IP address configuration (Linux)

- Java rewrite equals method (Programming)

- Linux ls command (Linux)

- 14 useful example Linux Sort command (Linux)

- To achieve a two-way static NAT stateless available modules on Linux (Linux)

- Build ftp server under CentOS 6.5 (Server)

- Linux platform Oracle MySQL connection (Database)

- Linux / CentOS 7.0 installation and configuration under Tomcat 8.0 (Server)

- GO five stages of language learning (Programming)

- Bash job control (Linux)

 
         
  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:      
 
- Syncthing: Private Security Synchronization tool to synchronize files between computers / folder (Linux)
- PostgreSQL Select source code analysis (Database)
- Android studio multi-channel ultra-compact version of the package (Programming)
- Linux iptables: basic principles and rules (Linux)
- Unsafe reboot start (Linux)
- Security: set limits on password (Linux)
- Based LNMP + uWSGI deploy Django applications (Server)
- Shell scripts quickly deploy Tomcat project (Server)
- Bad name two variables (Linux)
- Linux system security reinforcement system by masquerading method (Linux)
- pdf.js Tutorial (Linux)
- Linux itself disguised illusion strengthen security (Linux)
- Use backup-manager system backup on Linux (Linux)
- Linux System Getting Started Learning: The Linux logrotate (Linux)
- ogg start being given libnnz11.so: can not open shared object file (Database)
- Ubuntu development Nodejs (Linux)
- php performance monitoring module XHProf (Linux)
- Python calls the API interface in several ways (Programming)
- Get basic information about Linux server script (Server)
- Use SecureCRT to transfer files between local and remote hosts (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.