How to host a secondary website on a subdomain?
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
?20 Replies
:confusedpixeljoe:
you add the record
I tried that it always redirects to the main website running on port
80
that's... not how subdomains work
What record do I add then?
the same type that you use for www.example.com
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
then something is redirecting
I know that but how do I get it to redirect to the correct port
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:
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
ye once again, redirects don't happen on their own
I chose port
443
because it was already forwarded on the host server
well then how do I get it to redirect to a different port?.
not sure if this is available for all plans
I tried to create a origin rule but it comes up with error 1016
I created the A record for the subdomain but it's still redirecting to the main domain
Is it on the same server?
yeah
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
okay that kind of makes sense thank you