Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Server \ Nginx concerning the location and rewrite applications proxy_pass     - Linux Shell Understanding and Learning (Linux)

- Linux script to copy the folder to all folders with the same name (Linux)

- Linux processes in memory and memory cgroup statistics (Linux)

- SSH keys using login and password to log prohibited practice (Linux)

- To compile and install MySQL 5.7.7 RC under CentOS 7.1 (Database)

- Use PDFBox processing PDF documents (Linux)

- Python basis: os module on the file / directory using methods commonly used functions (Programming)

- Installation and use of Linux Sniffer tool Tcpdump (Linux)

- How to find out a Unix system library files are 32-bit or 64-bit (Linux)

- To install the Contiki development toolchain on Ubuntu (Linux)

- Linux NFS service fixed ports and firewall configuration (Linux)

- Java study notes: String (Programming)

- Under Linux using Magent + Memcached cache server cluster deployment (Server)

- Upgrading from Fedora 20 to 21 (Linux)

- ASM required disk format process in Solaris platforms (Linux)

- Python image processing library (PIL) to install and simple to use (Linux)

- How to install the Linux text editor Atom 0.124.0 (Linux)

- Vim useful plugin: EasyGrep (Linux)

- Python in yield (Programming)

- The Java way to stop a thread of execution (Programming)

 
         
  Nginx concerning the location and rewrite applications proxy_pass
     
  Add Date : 2018-11-21      
         
         
         
  1. Description of the problem

 upstream datacollectbackend {
      #ip_hash;
      server 10.234.1.211:6100 max_fails = 5 fail_timeout = 30s;
      server 10.234.1.26:7100 max_fails = 5 fail_timeout = 30s;
    }



      location ~ * ^ / OCC_DATACO_WEB /.*$ {
           include deny.conf;

           proxy_pass http: // datacollectbackend;
           include proxy.conf;

           error_log logs / datacollection_error.log error;
           access_log logs / datacollection_access.log main;
       }
Now just think OCC_DATACO_WEB name is too long, and would like to replace dt, but the project has not been on the line, you need to be a test, it is to let www.linuxidc / dt / possystem to call OCC_DATACO_WEB project to go inside.

That previously www.linuxidc / OCC_DATACO_WEB / possystem access, now replaced www.linuxidc / dt / possystem access. But the project still OCC_DATACO_WEB online, but now the project has not yet finished dt, in a transition period to wait for a new dt perfect after removing OCC_DATACO_WEB replaced dt

2, with the location of proxy_pass do Jump

And jump directly to OCC_DATACO_WEB same proxy_pass dt follows

 location ~ * ^ / dt /.*$ {
           include deny.conf;

           proxy_pass http: // datacollectbackend;
           include proxy.conf;

          error_log logs / dt_error.log error;
          access_log logs / dt__access.log main;
        }
Then restart nginx, by www.linuxidc / dt / possystem visit, the results being given as follows:

Sorry, can not find that page

URL you are using the likely misspelled, this page may have moved, or it may just be a temporary offline.
Retype the correct URL, or Home
3, instead of using the rewrite location

    location ~ * ^ / dt /.*$ {
          rewrite /dt/(.*) / OCC_DATACO_WEB / $ 1 break;

        }
Then restart nginx, use www.linuxidc / dt / possystem access, already in effect, a success.
4, summary

rewrite function is to use global variables nginx provided or set up their own variables, combined with regular expressions and flags achieve url rewrite and redirect. rewrite only on the server {}, location {}, if {}, and only on the parameters passed to remove the domain name back to work outside of the string, for example http://linuxidc.com/a/we/index .php? id = 1 & u = str only /a/we/index.php rewritten. Syntax rewrite regex replacement [flag];

If the relative domain name or function parameter string, you can use global variables to match, or you can use a reverse proxy proxy_pass.
Look rewrite capabilities and location show a bit like, can realize the jump, the main difference is that the rewrite is to change the access to resources within the same domain path, but location is a class path to make access control or reverse proxy, to other machines can proxy_pass . In many cases it will be written in the rewrite location where their execution order is:

Rewrite instruction execution server block
Execution location Match
Implementation of the selected location in the rewrite instruction
If either step URI is rewritten, re-execute cycle 1-3, until you find the file's existence; circulation of more than 10 times, 500 Internal Server Error error is returned.

This practice is the need to project a point to visit dt OCC_DATACO_WEB project to go inside, so you need only add proxy_pass location is not enough, we need to rewrite the.
     
         
         
         
  More:      
 
- Linux software firewall ACL match point optimization (Linux)
- Android imageView in the Src and Background (Programming)
- 3 tips Linux command (Linux)
- Copy Recovery using RMAN repository development environment (Database)
- Port is not being used, how will bind failure? (Server)
- Oracle query start with connect by tree (Database)
- Linux server is how to do after the invasion (Linux)
- Linux-based Heartbeat high availability configuration httpd service (Server)
- Understand the profound discussion of some of the options for wireless encryption (Linux)
- The method of installing software under Ubuntu Linux (Linux)
- Permissions and attributes of files and directories under Linux (Linux)
- Debian 7.7 Installation and Configuration (Linux)
- a virtual machine created migrated to host RHEL6.4 on Ubuntu 14.04 (Linux)
- Share useful bash aliases and functions (Linux)
- How to write a new Git protocol (Linux)
- MySQL Statistics (Database)
- Java implementation linear table - represents the order of representation and chain (Programming)
- XP virtual machine under VirtualBox solve occupy 100% CPU problem (Linux)
- Zabbix installation and configuration process (Server)
- RealVNC Server 5.2.3 Installation and Configuration In Fedora (Server)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.