Quantcast
Channel: Active questions tagged amazon-ec2 - Stack Overflow
Viewing all articles
Browse latest Browse all 29245

route CNAME with nginx and docker

$
0
0

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 CNAMEapi.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?


Viewing all articles
Browse latest Browse all 29245

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>