0

Sorry if this question is a bit jumbled up, I'm fairly new to Ubuntu\linux systems and don't know which information is important to post or not. More info at the bottom.

My question(s):

  1. How can I get it so when someone types in www.my_website.com from outside my network that URL will remain in the URL location? Right now, when someone connects to www.my_website.com it redirects them to my website -which is great- but it shows my public IP address and port number in the URL, 11.22.33.123:55355 rather than www.my_website.com. Obviously, not desirable for multiple reasons. How do I fix it so it shows my Domain Name in the URL? (I would like it if I didn't have to install other packages or make a virtualHost inside or a bind server, etc.) I want the website to be accessible from any public device too, Thanks in advance!!

  2. If question 1 is answerable, my next question: is there a relatively simple way to then make my website URL anything I want? For example, when someone types in from outside my network, www.my_website.com it would take them to the exact same website but when the page loads the url name is changed to whatever I want like www.my_customURL.com or whatever? I know I can't make that URL (www.my_customURL.com) to a public Domain Name without having to buy it (for example, if someone searches: www.my_customURL.com it will bring up someone else's bought Domain Name or return null) but I mean just for the application layer of things. Any ideas are most welcomed!

Extra info:

I installed ubuntu LAMP server and setup filezilla and webmin and finished setting up a practice html/css based website. I have it set in a VirtualBox environment with an abridged network adapter. My pseudo IP address for my website is: 192.168.0.10:55355 and I'm able to access it from my local network like usual. (i.e. from any computer on my wifi) I then preceded to port forward my website IP to be able to access it from anywhere outside my network/any public wifi. That worked great. I then bought a Domain Name from domains.google.com and was able to attach that Domain Name to my public IP address (the one seen by the entire internet) which then port-forwards that to my static website IP address which then presents my index.html file. For example, to access my website from inside or outside my network I can either type: public_ip:port_number (11.22.33.123:55355) or I can type: www.my_website.com

Both work like a charm. But that's where I want the Domain Name as URL or a custom URL to show and not my public IP and port number.

$ lynx lynx -head -dump http://www.my_website.com
HTTP/1.0 302 Found
Location: 11.22.33.123.:55355
Date: 23 Dec 2017 23:03:10 GMT
Content-Type: text/html; charset=UTF-8
Server: ghs
Content-Length: 222
X-XSS-Protection: 1; mode=block X-Frame-Options: SAMEORIGIN
AlexP
  • 10,435

1 Answers1

0

Your website is obviously set up to redirect people from my_website.com to 11.22.33.123.:55355.

You have to set up your webserver to answer to my_website.com. In Apache this is the ServerName directive. In other web servers, it's the same idea, but different configuration lines. This answer gives quite some information on how to set up vhosts in Apache.

You must also set up your webserver to listen to port 80, and do port forwarding from your router to your webserver. In addition you probably want a service providing Dynamic DNS, so that you don't have to update your DNS recrods every time your public IP changes. Then you set the domain name you buy to point to your dynamic dns name (typically given by the provider) as a CNAME-Record.

The reason you have to type in port number, is that HTTP is by default using port 80, and https is using port 443. It runs just fine on other ports, but this has to be specified, as you have discovered.

I do not know how googles domain admin panel is, and I do not know what you have entered there. Probably you've set up some kind of WWW forwarding there, and not configured it as a CNAME (points to another DNS name) or A (points to a IP address) record. You do want CNAME record pointing to either a dynamic dns name, or an A record pointing to your IP address.

And last: no, you have to pay a registrar for your domain.

This is touching briefly the surface of the topic, but I suggest you read up on the few things I've mentioned here. Most of them will be fairly well covered in other Q&A's on Askubuntu, which you'll find by searching, and if there's more specific questions, I suggest asking those - as this question covers a fairly broad topic.

vidarlo
  • 23,497