Timor-m 2018-6-17 11:58:03
Preface
The reverse proxy method refers to a proxy server that accepts connection requests on the Internet, then forwards the request to a server on the internal network and returns the results from the server to the client requesting the connection on the Internet, Reverse. At thi
Problem Background
In the practical application, we may need to obtain the user's IP address, for example makes the remote landing the judgment, or the statistics IP accesses the frequency and so on, usually we use the request. Remoteaddr can get to the client IP, but when we use the Nginx as a reverse proxy, use request. Remoteaddr gets the IP address of the Nginx server, then what should be done.
principl
Iis7Arr(Application requestThe routing module is 「Very powerful"Website tool, today I took a moment to study and successfully set the reverse proxy mechanism, because it is really difficult for beginners to get started with arr, even ifRegular Expression experienced it personnel may encounter many obstacles to successful setting. If they have never used URL rewrite or do not know
Ningx acts as a Load balancer and is also a reverse proxy server. The configuration syntax is quite simple. It can be used to balance the backend servers by round robin, IP_hash, url_hash, weight, and other methods, it also supports backend server health check. In addition, it has advantages over LVS because it is based on Layer 7 Server Load balancer and executes Server Load balancer tasks based on informa
In the JSP, the method to obtain the IP address of the client is: Request.getremoteaddr (), which is valid in most cases. However, the real IP address of the client cannot be obtained through the reverse proxy software such as Apache,squid.If the reverse proxy software is used, the URL of the http://192.168.1.110:2046/
Firstly, the nginx is introduced as a reverse proxy to achieve load balancing.
The reverse proxy means to accept the connection request on the Internet with the reverse proxy server, then forward the request to the server
Nginx's reverse proxy module has a number of configurations, the following are some common configuration examples:
1.proxy_pass
Syntax: Proxy_pass URL
Configuration block: location,if
Explanation: This configuration item reverses the current request to the server specified by the URL parameter, which can be the hostname or IP address plus port form. For example:
View plain print? nginx.conf configurat
The environment is: Windows2003 + nginx. (using the 1.5.10 version, the current version, as recommended by the official documentation.)
A simple configuration, let Nginx first run up
Nginx configuration is relatively simple. conf directory to find the nginx.conf file, modify the following configuration
The code is as follows
Copy Code
server {Listen 80; The listening port of the bindingserver_name www.111cn.net 111cn.net; The bound domain name#charset Koi8-r;#acces
In the actual project process, because the website to use an online editor (personalized online editing software), need to communicate across the domain! Because the cross-domain communication is more, so at that time think of proxy editing software requests on the website server!This is the actual demand of "reverse proxy"!One, nginx configuration
This blog post is the "Nginx implementation of dynamic/static file caching-technology flow Ken" two. This article will detail how Nginx implements reverse proxy and load balancing technology, supplemented by practical cases.Reverse proxy--"reverse proxy" means to accept a co
On the use of Sohu Sina IP Library query interfaceDirect output of guest IP and city:Scriptsrc= "Http://pv.sohu.com/cityjson?ie=utf-8" >Script>Scripttype= "Text/javascript">document.write ('IP:'+Returncitysn.cip+''+returncitysn.cname);Script>JS gets current provinces and cities based on IP addressThe map provides the coordinates that can be obtainedExampleDOCTYPE HTML>HTML>Head> Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8"> title>Iptesttitle> Head>Body>spanstyle= "
each other, after a process exits, the other processes are still working, the service will not be interrupted, the master process will soon start a new worker process. Of course, the worker process unexpectedly exits, must be the program has a bug, the exception exits, will cause all requests on the current worker to fail, but does not affect all requests, so reduces the risk. Of course, there are many advantages, we can slowly understand.Summary:Of course, Nginx is so high performance, there a
})/var ip_adDr = Ip_regex.exec (ice.candidate.candidate) [1];
Remove duplicates if (ip_dups[ip_addr] = = undefined) callback (IP_ADDR);
IP_DUPS[IP_ADDR] = true;
}
};
Create a bogus data channel Pc.createdatachannel (""); Create an offer SDP Pc.createoffer (function (result) {//trigger The stun server request Pc.setlocaldescription
(Result, function () {});
}, function () {}); Test:print the IP addresses into the console getips (function (IP) {console.log (IP);});
The ab
Changed from PHP Reverse Proxy PRP, modified some errors in the original, supporting the file upload and upload file type recognition, support the designated IP, Adaptive SAE environment.
How to use
Source
nginx.csr OpenSSL ca-in nginx.csr-out nginx.crt-days=3650
3. Create a client browser certificate
(umask 077;openssl genrsa-out client.key 1024)
OpenSSL req-new-key client.key-out client.csr OpenSSL ca-in client.csr-out client.crt-days=3650
Convert a certificate in text format to a certificate that can be imported into a browser
OpenSSL pkcs12-export-clcerts-in Client.crt-inkey client.key-out client.p12
4. Configure Nginx Server Authentication
All the files on my site are static HTML, so in order to speed up the speed of the web, I use squid to implement the reverse proxy caching function.
@ Install Squid
To be lazy, use the ports installation directly, because I have all the server systems installed in the/s partition, so set the prefix to/s/squid
# Cd/usr/ports/www/squid
# setenv Prefix/s/squid
# Make install clean
After the installation
services in the "reverse proxy" (Reverse proxy), one of the functions is to complete the distribution of the port. We may wish to use the domain name for the route distribution: all aa.com domain name request, distributes to the PHP 82 port execution, all bb.com domain name request, distributes to the ASP 83 port exec
Ask for advice !! I love segmentfault. So I refused Baidu. Ask for advice !!
I love segmentfault. So I refused Baidu.
Reply content:
Ask for advice !!I love segmentfault. So I refused Baidu.
In short
Forward Proxy: {client ---> Proxy Server} ---> server.{}Lan
Reverse Proxy: client ---> {
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.