Nginx 1.6.2 - Redirect users base on 4 digits number provide

Hello All,

I am trying to redirect users base on four digits number they provide.
For
instance, if they provide a number 4024 they will be redirect to web
server
name fly.fqdn.com, if digits are 5025 they will be directed to another
web
server name guide.fqdn.com. if this possible? if so, can someone point
to
instructions, I am confuse. New to Nginx.

Thanks in advance,
Motty

Posted at Nginx Forum:

On Thursday, October 02, 2014 10:51:25 AM mottycruz wrote:

Posted at Nginx Forum:
Nginx 1.6.2 - Redirect users base on 4 digits number provide


nginx mailing list
[email protected]
nginx Info Page

Probably Module ngx_http_map_module will come in handy. Depends on how many
entries you expect to have.

Best regards,
Styopa S…

Thank you very much Styopa, I am working on server that was installed by
person no longer in the company. I don’t know if Map modules was
originally
installed. I am using Ubuntu 10.04.4 TLS.

here is part of my current configuration:

upstream backend {
server alice.fqdn.com:80;
}

Note: This following “server” section allows Secure SSL reverse proxy

and
controlled redirecting.
server {
listen 443;
server_name bob;
ssl on;
ssl_certificate /usr/local/nginx/certs/apps.fqdn.com.crt;
ssl_certificate_key /usr/local/nginx/certs/bob-apps.key;
server_name_in_redirect on;
cust_app_version_routing_data_file
/usr/local/nginx/conf/cust_app_version_routing.dat;
cust_app_version_routing_apps app1,app2,app3;
access_log logs/host.access.log main;

    proxy_intercept_errors on;
    error_page 404 /myportal/Account/LogOn;
    # Main location
    location / {

my questions is can I add a second “upstream backend” and called
“upstream
backend2”? I would like to route specific 4 digits number to “upstream
backend2”? would this is a possibility?

Posted at Nginx Forum:

Thanks for the post, I am trying to install map module but I can’t
figure
out how to compile nginx with map module, I did the following:
./configure
–with-http_charset_module but get an error “invalid option”.

I would like to compile Nginx with upstread module as well, please help.

Posted at Nginx Forum:

Map and upstream are built by default, unless you removed them manually.
You might want to grab pre-built packages from the vendor:
http://wiki.nginx.org/Install , or from your OS repository.

On Friday, October 03, 2014 12:33:08 PM mottycruz wrote:

nginx mailing list
[email protected]
nginx Info Page

Best regards,
Styopa S…

On Thursday, October 02, 2014 12:14:41 PM mottycruz wrote:

Note: This following “server” section allows Secure SSL reverse proxy and

    cust_app_version_routing_apps   app1,app2,app3;

Posted at Nginx Forum:
Re: Nginx 1.6.2 - Redirect users base on 4 digits number provide


nginx mailing list
[email protected]
nginx Info Page

There was a similar thread here:

Hope this helps.

Best regards,
Styopa S…

On Monday, October 06, 2014 12:24:35 PM mottycruz wrote:

–add-module=/home/ngx_http_cust_app_version_routing
-Motty

Posted at Nginx Forum:
Re: Re: Re: Nginx 1.6.2 - Redirect users base on 4 digits number provide


nginx mailing list
[email protected]
nginx Info Page

Hello Motty,

I’m a little bit confused by your question. If your goal is to serve
different URLs by different backends, the config will look like this:

location = /app2 {

this will strip “/app2” from the request to the backend

e.g. user request of: /app2/index.do?foo=bar

will be routed to app2 backend as:

/index.do?foo=bar

proxy_pass http://app2.server2.com/;
}

If your goal is to return HTTP 301 permanent redirect, it will be:
location = /app2 {
return 301 $scheme://app2.server2.com/;
}

Please be sure to read the following info (it’s pretty short actually):
http://nginx.org/r/location
http://nginx.org/r/proxy_pass

Unfortunately, I’m not familiar with 3rd-party modules, so I cannot
advise on them.

Sincerely yours,
Styopa S…

Thanks for your help Styopa,

I was able to find modules installed on our current proxy with the
following
command, because we have a customize module.

:~# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/0.7.67
built by gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module
–add-module=/home/ngx_http_cust_app_version_routing

I tried to redirect base on URL

for instance I tried:
Redirect ^/app2$ http://app2.server2.com;

but does not seem to be working, I can’t find much in the logs. do you
have
any suggestions?

Thanks,
-Motty

Posted at Nginx Forum: