Forwarding Multiple port to Single port using nginx
up vote
5
down vote
favorite
I want to proxy pass all requests coming from a series of ports into single port.
I am able to proxy pass a single port to another like so:
server {
listen 3333;
server_name test.in *.test.in;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
So when I try test.in:3333 it redirects to 10.1.1.2:5479.
In the same way I need to proxy pass these:
test.in 4440 to 10.1.1.2:5479
test.in 4441 to 10.1.1.2:5479
test.in 4442 to 10.1.1.2:5479
How can I do this?
nginx reverse-proxy
add a comment |
up vote
5
down vote
favorite
I want to proxy pass all requests coming from a series of ports into single port.
I am able to proxy pass a single port to another like so:
server {
listen 3333;
server_name test.in *.test.in;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
So when I try test.in:3333 it redirects to 10.1.1.2:5479.
In the same way I need to proxy pass these:
test.in 4440 to 10.1.1.2:5479
test.in 4441 to 10.1.1.2:5479
test.in 4442 to 10.1.1.2:5479
How can I do this?
nginx reverse-proxy
add a comment |
up vote
5
down vote
favorite
up vote
5
down vote
favorite
I want to proxy pass all requests coming from a series of ports into single port.
I am able to proxy pass a single port to another like so:
server {
listen 3333;
server_name test.in *.test.in;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
So when I try test.in:3333 it redirects to 10.1.1.2:5479.
In the same way I need to proxy pass these:
test.in 4440 to 10.1.1.2:5479
test.in 4441 to 10.1.1.2:5479
test.in 4442 to 10.1.1.2:5479
How can I do this?
nginx reverse-proxy
I want to proxy pass all requests coming from a series of ports into single port.
I am able to proxy pass a single port to another like so:
server {
listen 3333;
server_name test.in *.test.in;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
So when I try test.in:3333 it redirects to 10.1.1.2:5479.
In the same way I need to proxy pass these:
test.in 4440 to 10.1.1.2:5479
test.in 4441 to 10.1.1.2:5479
test.in 4442 to 10.1.1.2:5479
How can I do this?
nginx reverse-proxy
nginx reverse-proxy
edited Apr 2 '15 at 11:59
jkt123
2,5541220
2,5541220
asked Apr 2 '15 at 11:38
Hari
148118
148118
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
5
down vote
accepted
You should be able to do this by setting up multiple server
blocks, similar to the one in your example, listening on the different ports (4440, 4441, and 4442) and having an identical proxy_pass configuration section.
For example:
server {
listen 4440;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
server {
listen 4441;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
server {
listen 4442;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
add a comment |
up vote
12
down vote
It's also working...
server {
listen 4442;
listen 4441;
listen 4443;
listen 4444;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
You should be able to do this by setting up multiple server
blocks, similar to the one in your example, listening on the different ports (4440, 4441, and 4442) and having an identical proxy_pass configuration section.
For example:
server {
listen 4440;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
server {
listen 4441;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
server {
listen 4442;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
add a comment |
up vote
5
down vote
accepted
You should be able to do this by setting up multiple server
blocks, similar to the one in your example, listening on the different ports (4440, 4441, and 4442) and having an identical proxy_pass configuration section.
For example:
server {
listen 4440;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
server {
listen 4441;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
server {
listen 4442;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
add a comment |
up vote
5
down vote
accepted
up vote
5
down vote
accepted
You should be able to do this by setting up multiple server
blocks, similar to the one in your example, listening on the different ports (4440, 4441, and 4442) and having an identical proxy_pass configuration section.
For example:
server {
listen 4440;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
server {
listen 4441;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
server {
listen 4442;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
You should be able to do this by setting up multiple server
blocks, similar to the one in your example, listening on the different ports (4440, 4441, and 4442) and having an identical proxy_pass configuration section.
For example:
server {
listen 4440;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
server {
listen 4441;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
server {
listen 4442;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
answered Apr 2 '15 at 11:56
jkt123
2,5541220
2,5541220
add a comment |
add a comment |
up vote
12
down vote
It's also working...
server {
listen 4442;
listen 4441;
listen 4443;
listen 4444;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
add a comment |
up vote
12
down vote
It's also working...
server {
listen 4442;
listen 4441;
listen 4443;
listen 4444;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
add a comment |
up vote
12
down vote
up vote
12
down vote
It's also working...
server {
listen 4442;
listen 4441;
listen 4443;
listen 4444;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
It's also working...
server {
listen 4442;
listen 4441;
listen 4443;
listen 4444;
location / {
proxy_pass http://10.1.1.2:5479/;
include /etc/nginx/proxy_params;
}
}
edited Apr 9 '15 at 14:27
jkt123
2,5541220
2,5541220
answered Apr 3 '15 at 6:17
Hari
148118
148118
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f604408%2fforwarding-multiple-port-to-single-port-using-nginx%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown