NGINX study notes - Choosing an Outgoing IP Address

WBOY
Release: 2016-07-29 08:56:19
Original
2105 people have browsed it

Original address: https://www.nginx.com/resources/admin-guide/reverse-proxy/
Original title: Choosing an Outgoing IP Address

If your proxy server has multiple network interfaces, sometimes you may need to select a specific source IP address to connect to the proxy server or upstream server. This configuration can come in handy if a proxy server behind NGINX is set up to only accept connections from a specific IP network or IP address range.
If your proxy server has several network interfaces, sometimes you might need to choose a particular source IP address for connecting to a proxied server or an upstream. This may be useful if a proxied server behind NGINX is configured to accept connections from particular IP networks or IP address ranges.

Specify the proxy_bind directive and set the IP address of the network interface:
Specify the proxy_bind directive and the IP address of the necessary network interface:

<code>location <span>/app1/</span> {
    proxy_bind <span>127.0</span><span>.0</span><span>.1</span>;
    proxy_pass <span>http</span>:<span>//</span>example.com<span>/app1/</span>;
}</code>
Copy after login
<code>location <span>/app2/</span> {
    proxy_bind <span>127.0</span><span>.0</span><span>.2</span>;
    proxy_pass <span>http</span>:<span>//</span>example.com<span>/app2/</span>;
}</code>
Copy after login

The IP address can also be specified using variables. For example, the $server_addr variable passes the IP address of the network interface that received the request.
The IP address can be also specified with a variable. For example, the $server_addr variable passes the IP address of the network interface that accepted the request:

<code>location /app3/ {
    proxy_<span>bind</span><span>$server_addr</span>;
    proxy_pass http://example.com/app3/;
}</code>
Copy after login
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces the NGINX study notes - Choosing an Outgoing IP Address, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!