#How to host a secondary website on a subdomain?

27 messages · Page 1 of 1 (latest)

hushed hearth
#

So I'm hosting a website www.example.com on port 80 and that is working fine. I am hosting another website on port 443. How would I go about creating a DNS record, test.example.com, for the website hosted on port 443?

#

How to host a secondary website on a subdomain?

stark hearth
#

you add the record

hushed hearth
#

I tried that it always redirects to the main website running on port 80

stark hearth
#

that's... not how subdomains work

hushed hearth
#

What record do I add then?

stark hearth
hushed hearth
#

I'm using an A record, but whenever I tried to add an A record for test.example.com for the port 443 but it always redirects to www.example.com and port 80

stark hearth
#

then something is redirecting

hushed hearth
#

I know that but how do I get it to redirect to the correct port

stark hearth
#

Port 80 is for http traffic, 443 for https... this setup alone sounds... unconventional

i would highly recommend you use something like nginx to route requests based on hostname

#

Alternatively you can create a origin rule to redirect traffic to a specific port by hostname shrugpepe

hushed hearth
#

I'm trying to host a maven repo at a different port that the main webserver but any port that I choose it always redirects traffic to the main webserver at port 80

stark hearth
#

ye once again, redirects don't happen on their own

hushed hearth
#

I chose port 443 because it was already forwarded on the host server

hushed hearth
stark hearth
#

not sure if this is available for all plans

hushed hearth
#

I created the A record for the subdomain but it's still redirecting to the main domain

hushed hearth
#

yeah

jade ruin
#

Use something like NGINX with a reverse proxy then

#

Basically, you tell two servers to listen on port 80, but set the actual like web servers to listen internally on different ports (e.g. 150 and 151) and then you use NGINX with a reverse proxy to listen on port 80 twice but on different server names

hushed hearth
#

okay that kind of makes sense thank you