2

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 Answer 1

2

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>
Sign up to request clarification or add additional context in comments.

2 Comments

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.
mikhailov, You were right. I finally solved the problem. I can spend happy weekend because of you. Really Really thank you. I love you !!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.