Maison > développement back-end > tutoriel php > NGINX学习笔记——Choosing an Outgoing IP Address

NGINX学习笔记——Choosing an Outgoing IP Address

WBOY
Libérer: 2016-07-29 08:56:19
original
2127 Les gens l'ont consulté

原文地址:https://www.nginx.com/resources/admin-guide/reverse-proxy/
原文标题:Choosing an Outgoing IP Address

如果你的代理服务器有多个网络接口,有时候你可能会需要选择特定的源IP地址连接被代理服务器或者上游服务器。如果NGINX后面的一个被代理服务器设置为只接受特定IP网络或者IP地址范围的连接,这种配置就能派上用场了。
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.

指定proxy_bind指令并设置网络接口的IP地址:
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>
Copier après la connexion
<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>
Copier après la connexion

IP地址也可以用变量指定。例如,$server_addr变量会传递接收到请求的网络接口的IP地址。
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>
Copier après la connexion
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

以上就介绍了NGINX学习笔记——Choosing an Outgoing IP Address,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal