By user2314255


2015-07-09 15:41:26 8 Comments

We have 3 Jenkins instances for DEV/STG/PRD in a single CI Server. It uses 3001,3002 and 3003 TCP ports for each. For example, If I want to access STG Jenkins, I can access the server with the URL "192.168.0.3:3002".

But now we have to move the Jenkins instances to behind Nginx Server for remote users, the users only can access the Jenkins through Nginx and port no 443. Only TCP 443 port of their Fire Wall is opened for outbound traffic. Because of this reason(Single Nginx instance of TCP 443), the only way to distinguish between DEV/STG/PRD is to use different URI.

For example:

  • "192.168.0.3:3001" --> "192.168.0.3:443/dev"
  • "192.168.0.3:3002" --> "192.168.0.3:443/stg"
  • and so on.

Below is a sample NginX configuration for port forward I expect.

server (
listen 443;
server_name localhost;
location /dev (
proxy_pass http://localhost:3001;
)
location /stg (
proxy_pass http://localhost:3002;
)
location /prd (
proxy_pass http://localhost:3003;
)
)

Is it possible? Does Nginx support multiple ports forward with a single instance?

1 comments

@Anatoly 2015-07-09 18:44:44

Yes, Nginx supports multiple upstream, the only change you need to make is to customise Jira server XML config path:

See full config below: https://gist.github.com/mikhailov/8562320

    <Engine name="Catalina" defaultHost="localhost">
      <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
        <Context path="/jira" docBase="${catalina.home}/atlassian-jira" reloadable="false" useHttpOnly="true">
          <Resource name="UserTransaction" auth="Container" type="javax.transaction.UserTransaction"
            factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60"/>
          <Manager pathname=""/>
        </Context>
      </Host>
    ....
    </Engine>

@user2314255 2015-07-10 00:00:17

I am really thank you, mikhailov. As I am a newbie of NginX, little bit strange thing is it's related with JIRA, But I will give it a try. Thanks.

@user2314255 2015-07-10 01:34:32

mikhailov, You were right. I finally solved the problem. I can spend happy weekend because of you. Really Really thank you. I love you !!!

Related Questions

Sponsored Content

0 Answered Questions

2 Answered Questions

Keycloak Redirect url with nginx is going to http rather than https

  • 2018-04-03 12:02:15
  • Atulya Nair
  • 1097 View
  • 3 Score
  • 2 Answer
  • Tags:   nginx jboss

2 Answered Questions

[SOLVED] Express - req.ip returns 127.0.0.1

0 Answered Questions

Is it possible to use a nginx proxy on the same port as the listening port?

2 Answered Questions

2 Answered Questions

How to point many paths to proxy server in nginx

1 Answered Questions

Configuring nginx to allow HTTPS traffic on a custom port

3 Answered Questions

0 Answered Questions

how to hosting multiple Nodejs applications with nginx

  • 2014-09-17 10:26:58
  • mark
  • 192 View
  • 1 Score
  • 0 Answer
  • Tags:   node.js nginx

1 Answered Questions

[SOLVED] SSL port unification with nginx and SNI

  • 2014-07-29 15:51:23
  • prokoba
  • 566 View
  • 1 Score
  • 1 Answer
  • Tags:   ssl nginx sni

Sponsored Content