How do I change the default port of a web server
Hello.
I only have a single node, but with multiple domains, all of which point the same IP address that node is assigned.
Let's say my IP address is 12.34.567.89, and my domains are AAA.com, BBB.com, CCC.com, where the first two are already up running, and CCC.com is the one not yet deployed.
Suppose I am going to host a Django website and let it run ONLY on CCC.com, and it's running on port 1234, and it definitely works at CCC.com:1234 (GOOD).
However, I just realize that all the following URL work because they all point to the same IP address, and that is what the port is attached to.
AAA.com:1234 (BAD)
BBB.com:1234 (BAD)
12.34.567.89:1234
I know http defaults to port 80, and https to 443.
How can I prevent AAA.com and BBB.com from being able to render the Django website I reserve for CCC.com? How do I manually set default to another port? For example, typing in URL "AAA.com" would automatically visit "AAA.com:1234", where 1234 is the new default port number wanted.
1 Reply
For making changes to the port number, that's a simple edit to the conf file for the web server you're running. You have the ability to change or add to the ports that the web server is listening on. Here's a post that covers how to make changes to the listening ports for Apache:
As for configuring a domain specific port, DNS only points to an IP, not to a port. As such, you won't be able to differentiate ports based on domains. Linode has a great guide on DNS Records:
We also have a number of web server guides: