I have a new job and they have everything set up on AWS. We have a test server which is hosting a number of applications.

if I go to


it goes to the instance of Jenkins that we have running.

if I go to


Then it goes to the test version of our application.

Where is this configured (different apps for different "subdomains")? Is it in Nginx, or in the DNS entries? Or both or somewhere else?

(I am not 100% sure of thr terms I should be using to ask this question, such as "subdomains", feel free to tell me what they are).

  • 2
    This question is way too local. There are a hundred ways that this could be configured and you will need to ask your coworkers for guidance. – Stefan Lasiewski Oct 13 '15 at 20:54
  • So where should I be asking if this is "off topic"? It seemed more relative to server fault than Stack overflow. – wobbily_col Oct 14 '15 at 15:23
  • The members of ServerFault are not going to know specifics about your companies use of AWS. – Stefan Lasiewski Oct 14 '15 at 19:06
  • Its not uncommon to have domains set up with subdomains, so thats why I am asking. – wobbily_col Oct 15 '15 at 17:46

It depends on what you want to do.

What you're asking likely requires Nginx as opposed to added DNS entries.

CNAME DNS entries can redirect certain subdomains to a certain domain (but not directly to a specific IP address or port on a server). You only need a CNAME if you are mapping a subdomain redirect the request to a different domain name (i.e. subdomain.exampleone.com refers to exampletwo.com).

Nginx can act as a reverse proxy, taking subdomains and redirecting them to either a particular folder/files or port on your server. This is configurable either from your /etc/nginx/nginx.conf*, within the http {...} block, or in the /etc/nginx/sites-enabled/ directory, where you can create a separate file for each redirect (where http {...} is implied).

*or wherever your nginx directory is located

The proper format for such a redirect (to an application on a specific port) in your /etc/nginx/nginx.conf is like this:

server {
    # whether you type localhost or or something else here 
    # depends on your servers /etc/hosts file, where you define how 
    # the server refers to itself
    listen       localhost:80;  
    server_name  mysubdomain.example.com;

    location / {
     proxy_pass              http://localhost:MYPORTNUMBER
     proxy_set_header        Host            $host;
     proxy_set_header        X-Real-IP       $remote_addr;
     proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

Where you replace MYPORTNUMBER with the port the application is running on. The process for redirecting to static files is similar, but instead of proxy_pass, you would do root /path/to/desired/folder.

I haven't specifically tried it, but this should work for multi-level subdomains like the server.test.ourdomain.com in your example.

Not the answer you're looking for? Browse other questions tagged or ask your own question.