Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Server \ Nginx load balancing configuration (http proxy)     - Implicit conversion from Java type conversion compare MySQL and Oracle (Database)

- What factors affect the performance of Java calls (Programming)

- The FreeBSD zfs: failed with error 6 Error Resolution (Linux)

- grep command usage (Linux)

- Sshuttle A VPN-based transparent proxy that uses ssh (Server)

- Java study notes: String (Programming)

- Linux Desktop allows exceptionally different launch applications (Linux)

- DDOS Attacks and Prevention (Linux)

- Installation in lxml Python module (Linux)

- Ubuntu Server (Ubuntu 14.04 LTS 64-bit) installation libgdiplus 2.10.9 error solution (Linux)

- Depth understanding of the use of Spring Redis (Programming)

- Steps to build MPICH2 development environment on CentOS 6.4 (Linux)

- hexdump Linux command (Linux)

- C # DateTime structure common method (Programming)

- Ftp user to create multiple virtual machines to support different access rights Examples (Server)

- CentOS7 installation hardware monitoring for Zabbix enterprise applications (Server)

- Ubuntu 14.10 install KDE Plasma 5.2 (Linux)

- Install the free open source financial software GnuCash 2.6.6 under Ubuntu (Linux)

- Ubuntu 14.04 install the NVIDIA driver + CUDA + MATLAB (Linux)

- Hackers is how the invasion and control of Things devices? (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:      
 
- S5PV210 development board for embedded development environment to build under Ubuntu (Linux)
- Use Markdown editor for document work under Linux (Linux)
- Squid proxy server (Server)
- Java application server WildFly (Server)
- Binary search -Java achieve (Programming)
- Build Nginx + uWSGI + Flask operating environment under CentOS 6.4 tutorial (Server)
- Linux Getting Started tutorial: Ubuntu 14.04 in the installation Sogou Pinyin (Linux)
- CentOS 7 hard disk expansion toss record (Linux)
- Android basics summary article (Programming)
- ASM learning overview (Database)
- CentOS 6.5 system installation Oracle11.2.0.4 basic steps (Database)
- Linux server security settings to close unused ports (Linux)
- File easier to compare tools under Linux (Linux)
- Linux System Getting Started Learning: Repair fatal error openssl aes h no such file or directory (Linux)
- Java generate two-dimensional code by Zxing (Programming)
- Linux Network Programming - non-blocking program (Programming)
- Give your photos Instagram style filters plus program in ubuntu (Linux)
- Ubuntu 14.04 build Android 5.1 development environment and compiler (Linux)
- Linux installation and configuration curl command tool (Linux)
- CentOS installation of the ftp (Linux)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.