Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Server \ Nginx load balancing configuration (http proxy)     - Linux Getting Started Tutorial: How to set up a static MAC address on VMware ESXi virtual machine (Mobile)

- Vagrant build LNMP environment (Server)

- The ActiveMQ JMS installation and application examples for Linux (Linux)

- Zookeeper Rights Management and Quota Management (Server)

- MySQL configuration file my.cnf increase the log file parameter error (Database)

- Java Network Programming Internet address lookup (Programming)

- Linux Mint brightness adjustment --xrandr command learning (Linux)

- Mahout source code analysis: FP-Growth algorithm parallelization (Programming)

- About Linux iptables firewall interview questions and answers (Linux)

- GCC and gfortran write MEX program (Matlab2012a) under Ubuntu 14.04 (Programming)

- Linux support exFAT and NTFS (Linux)

- Chkconfig set boot start under Linux (Linux)

- Android Studio commonly used shortcuts and how to follow the Eclipse Shortcuts (Linux)

- Automatic batch resolve dependencies problem locally installed rpm package (Linux)

- Java factory pattern (Factory mode) (Programming)

- Struts2 : combobox label use (Programming)

- Java NIO2: Buffer (Programming)

- RedHat command line and graphical interface switching (Linux)

- Math objects easily overlooked but very convenient method --JavaScript (Programming)

- Linux (RHEL6 CENTOS6 OLE6) VNC-SERVER Installation and Configuration (Server)

 
         
  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:      
 
- Linux system started to learn: Teaches you install Ubuntu 15.04 on VirtualBox (Linux)
- MongoDB relations, references, index query coverage (Database)
- sudo command scenario analysis (Linux)
- Unity Greeter Badges: the lost session icon back to the login screen Ubuntu (Linux)
- Android webView URL redirects affect goBack () (Programming)
- Actual custom yum repository ---- gem commands commonly used parameters (Linux)
- Android Service service applications and the phone SMS Listener Listener (Programming)
- Spring loaded container finishes executing a method (Programming)
- To install Jetty server configuration in detail (Server)
- Ubuntu Control Panel to resolve network-manager icon display issue (Linux)
- Linux Getting Started tutorial: Borrow Windows fonts in Ubuntu 14.10 (Linux)
- Linux system boot process ARM platforms (Linux)
- Spring classic face questions Share (Programming)
- How UTorrent download the ISO image from the command line (Linux)
- Oracle how to assess the true concurrent session (Database)
- Unsafe reboot start (Linux)
- Linux file system data file deletion problem space is not freed (Database)
- How to find on Linux and delete duplicate files: FSlint (Linux)
- Five kinds of IO Model under Linux (Programming)
- Oracle 11g RMAN virtual private directory (Database)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.