Routing a subdomain to a folder on another server via AWS route53

I have an EC2 Win2008 server running an ASP.NET 4.5 site www.mysite.com.

In the same AWS zone but another separate EC2 Linux server, I have an NginX/PHP WordPress site running blog.mysite.com.

Read More

I would like to create an AWS Route53 route so that all incoming requests to www.mysite.com/blog get silently routed to blog.mysite.com WITHOUT a redirect so that the user’s web browser stays on the URL www.mysite.com/blog

How would I achieve this with Route53? If not achievable with Route53, is there any other way?

I don’t want to run PHP/MySQL/WordPress on my Windows server, unless I absolutely have to.
Thanks!

Related posts

Leave a Reply

1 comment

  1. Only way is to put an Apache or nginx in front of both the site that is hosting your ASP.NET 4.5 app and your WordPress site.

    Then you can setup a reverse proxy on that server that makes that /blog path point to your WordPress site and the / path point to your ASP.NET 4.5 app.

    For nginx you would have something like this:

    server {
        listen       80;
        server_name  www.yourdomain.com;
    
        access_log  /var/log/nginx/log/www.yourdomain.access.log  main;
        error_log  /var/log/nginx/log/www.yourdomain.error.log;
    
        location /blog {
          proxy_pass  http://yourblogserver;
          proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
          proxy_redirect off;
          proxy_buffering off;
          proxy_set_header        Host            $host;
          proxy_set_header        X-Real-IP       $remote_addr;
          proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
       }
    
        location / {
          proxy_pass  http://youraspnet40server;
          proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
          proxy_redirect off;
          proxy_buffering off;
          proxy_set_header        Host            $host;
          proxy_set_header        X-Real-IP       $remote_addr;
          proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
       }
    }
    

    Keep in mind that your /blog path has to be first in the priority otherwise all the requests will get sent to just /