Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

277
Views
route CNAME with nginx and docker

I'm trying to achieve api.com => api.myapp.com without success.

main nginx run on aws/ec2 on docker and listen to port 80

server {
    listen 80;
    server_name myapp.com;
    location / {
        proxy_pass http://app:80/;
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
    }
}

server {
    listen 80 l;
    server_name api.myapp.com;
    location / {
        proxy_pass http://api:80/;
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
    }
}

myapp.com domain configured

A Record => @(host) => 1.10.10.30(aws-ec2/ip)

A Record => api(host) => 1.10.10.30(aws-ec2/ip)

with this configuration it works fine. visiting myapp.com resolves app, and api.myapp.com resolves api service.

(I hope it's ok until now, so let me know if it wrong way to do it)

the problem

Now, I want to configure api.com with CNAME api.myapp.com. I went to my domain manager(godaddy) and set as:

CNAME => www => api.myapp.com

when i visit api.com it resolves myapp.com and not api.myapp.com

what should i do?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!