Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Server \ Nginx load balancing configuration (http proxy)     - Java interface (Programming)

- Getting jQuery - progress bar (Programming)

- Fedora 20 Installation and Configuration (Linux)

- mysqldump MySQL command-line tool (Database)

- TL-WR703N to install OpenWrt process notes (Linux)

- In Debian 4.3 compiler under Linux-2.6.28 kernel Summary (Programming)

- JavaScript is implemented without new keywords constructor (Programming)

- CentOS 7.0 running Docker kernel error solution (Server)

- Installation Flow N Play- interface stylized video player on Ubuntu (Linux)

- Internal class broadcasting needs public and static (Programming)

- Oracle through the alarm log view and inspect the main library, physical and snapshot standby database (Database)

- Compression software on a simple comparison of zip and gz (Linux)

- Oracle database file path changes (Database)

- Linux basic introductory tutorial ---- regex basis (Linux)

- JavaScript object - Flexible and dangerous (Programming)

- How apt-get limited use IPv4 or IPv6 protocol to download (Linux)

- Keepalived + HAProxy high availability load balancing (Server)

- Linux ban single-user mode to enhance system security (Linux)

- Oracle JDK installation under Ubuntu Linux (Linux)

- Convert MySQL date string to a NULL value exception handling (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:      
 
- The YUM package management under Linux (Linux)
- ORA-01000 Solution (Database)
- To install HDRMerge 0.4.3 under ubuntu (Linux)
- Cool Android realization SVG animation (Programming)
- Introduction and MongoDB CRUD (Database)
- How to build a container cluster (Server)
- Upload the project to GitHub, synchronous remote repository Github (Linux)
- MySQL 5.6 Open full query log (Database)
- Use pg_basebackup build PostgreSQL streaming replication environment (Database)
- CentOS 7 server environment to quickly build Linux (Server)
- Linux Creating a new user error Creating mailbox file: File exists (Linux)
- 20 Advanced Java interview questions summary (Programming)
- CentOS card fails to start at boot progress bar certmonger solve (Linux)
- Apache Kafka: the next generation of distributed messaging system (Server)
- Linux partition command (Linux)
- Open container cluster management system architecture and components introduced Kubernetes (Server)
- SUSE Linux firewall configuration notes (Linux)
- The basic principle of pointers in C ++ (Programming)
- Use SocketServer write a sockets program (Programming)
- Oracle 11g RAC manually playing GI PSU patch (11.2.0.4.8) (Database)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.