0

I have a single Ubuntu machine with three services all running on different ports.

  • GitLab running on port 80
  • EtherPad running on port 9001
  • GemInABox running on port 9292.

There are three DNS names pointing to this one Ubuntu server, gitlab.domain.com, etherpad.domain.com, and geminabox.domain.com.

The GitLab service works well with Nginx, no changes needed here. However, I'm not sure how to configure Nginx to allow requests to etherpad.domain.com to pass through to etherpad.domain.com:9091, and requests to geminabox.domain.com to pass through to geminabox.domain.com:9292.

Is this possible?

3 Answers 3

8

I think you can use the nginx you have for GitLab and, as @moebius_eye suggests, configure it as a reverse proxy for Etherpad and GemInABox. Also, to incorporate the functionality you wanted to approach via DNS, you could use what in nginx is called Server Blocks (a concept similar to Virtual Hosts on apache).

You would have to modify your nginx configuring file to contain something of the sort of:

server{
    server_name etherpad.domain.com;

    location / {
        proxy_pass http://localhost:9091/;
        proxy_set_header Host $host;
    }
}

server{
    server_name geminabox.domain.com;

    location / {
        proxy_pass http://localhost:9292/;
        proxy_set_header Host $host;
    }
}

You could look up documentation about the nginx Proxy module and about Server Blocks to fit that configuration to your needs, but I think the above is the minimum you need.

Finally, I think there is no straight DNS way to do what you are asking for.

1
  • 1
    Thanks! This was the clue I needed. The only required addition is listen 80; just before the server_name line.
    – hooinator
    Apr 20, 2015 at 17:56
3

What you're looking for is the nginx reverse proxy feature.

Read the docs.

1

As long as the specific server app/protocol doesn't support it (in the form of SRV records, wiki link), DNS can't be used for this purpose.

Not the answer you're looking for? Browse other questions tagged .