I currently have an apache web server setup on my raspberry pi running Raspbian. I've opened the ports on my router and registered a domain name through a website. In the website I set the domain to forward to my pi's external IP address which works fine.
The problem I'm having is that when the browser gets to the site which is accessed by url, it displays the test page I have set up but in the address bar the IP is displayed and not the URL. Is there a way to change it so it will display my URL?
Create an A record. Read the post below.
https://support.dnsimple.com/articles/a-record/
You need to set an A record to point the domain name at that IP address, instead of forwarding to a URL with the IP.
Related
I started learning some website designing and I wonder how can I make my site adress look f. ex. like ender.com instead of IP address and port. I'm doing everything on my own computer, so I would really appreciate way, which will allow me to host a website on it. I'm a beginner, so I'd like to know if I'm even capable of doing this.
You need a domain name in which you're gonna host your website, in your case its ender.com, as you run your website from your own pc it shows your localhost and port instead of ender.com as you don't own that domain. Only way to show ender.com is that you buy that domain and host the website with that purchased domain.
Refer this for more info https://blog.resellerclub.com/how-to-host-a-domain-website-on-your-own/#:~:text=%20A%20few%20steps%20on%20how%20to%20host,may%20have%20issues%20here%20based%20on...%20More%20
Currently I have a golang app that is serving at X.X.X.X:443. Suppose my domain name is example.com. I want to link example.com to X.X.X.X:443. I tried entering this into A Record but it doesn't allow me to use port. Therefore, I currently use URL Redirect Record. I tried to link CNAME Record to this URL Redirect Record but to no avail. It just keeps showing my ip address instead of example.com.
I don't mind having example.com:443.
Can I know how should I solve this problem? Is it supposed to be solved on the DNS side? Some suggest that I must host on port 80. Is it true?
According to the documentation (https://cloud.google.com/appengine/docs/standard/go/tools/local-devserver-command)
the parameter to change the host is : --admin_host=ADMIN_HOST
Definition is : "Host name to which the local development server's administration console should bind (default: localhost)."
I'm in the process of launching a new website. I migrated all the code to the new server. The admin at the new host told me that I have to add an entry to my hosts file and then I will be able to see the website. So essentially he had me add:
111.222.3333.4444 example.com www.example.com
These are example, but after doing this, it worked. My question is, is how? If I visit the IP directly in my browser I get a 403 Forbidden error. Does the host have a way to resolve this IP to a location on their server if resolved from a domain name? I'm just confused as to how this works. I understand that by changing the IP address I can get the domain name to resolve to any IP, but I'm wondering why, on the hosts end, does this now resolve this way, but not by typing in the IP directly.
Thanks!
Does the host have a way to resolve this IP to a location on their
server if resolved from a domain name?
Not exactly. Your browser, when sending the request to the IP address, will send one important piece of information called 'Host header', that is the actual host name as you typed in your browser.
You usually can not open the website just by entering the IP address in your browser's address bar because web servers (and possibly many other network components that are between you and the web server) often do not host only one web site on that IP address so they rely on exact domain name typed in address bar to serve the right content.
You can test this by using one of the browser add-ons that allow you to add your own headers. Add header named 'Host' with the value 'example.com' and with that try to open your site by typing only provided IP address.
I have a a website on my server on a subdomain. let's say at this adress:
subdomain.sourceserver.com/site/
I mapped a freshly bought domain (mynewdomain.com) to my server. So now mynewdomain.com resolves with the IP of my server.
And http://mynewdomain.com displays the website located at subdomain.source-server.com/site/
When I start browsing in the pages of the website, the adress displayed changes back to http://subdomain.sourceserver.com/site/blabla.php
I would like to keep it with the domain name:
http://mynewdomain.com/blabla.php
How can I do that ?
Do I have to create a CName on the DNS zone subdomain.sourceserver.com ?
Thanks in advance !
Cheers,
Mat
DNS is not what's changing the address in your browser, it is likely your web code or web server config. My suspicion is that your site is configured to be "subdomain.sourceserver.com/site/", so links inside the site are pointed at "http://subdomain.sourceserver.com/site/something.file", which is why the visible URL changes.
http://mynewdomain.com is resolving to the same IP address as your previous name, so your web browser is taking you to the same content. Unless you have virtual hosts configured so that the server pays attention to the headers, it will simply serve out the content to the request that lands on it's IP:port.
Virtual host examples
I want to change my hosts file to redirect a web address to my site...
normally I would just do... ping mysite.com then in the hosts file, if the IP came out as 99.99.99.99, I'd write...
99.99.99.99 siteiwanttoredirect.com
But in this case my site is on virtual shared hosting... which means the IP I get back from the ping is the same as a few other sites and if I type that IP in the address bar, www.mysite.com won't come up. Here's a bit more details: someone who asked a question about why pinging it wouldn't give the correct IP.
So what I would like to know is... if you're on virtual shared hosting, how can you specify redirects to your site in the hosts file?
Thanks,
Matt
You cannot. With the hosts file you can change the IP address, but your shared hosting provider needs the HTTP Host header to be set up correctly -- which in your case will still be siteiwanttoredirect.com and not mysite.com . Your hosting provider will therefor not know who's site to show.
What you could do is redirect to some host you control (f.i. localhost) and run a proxy server there. If you set up Apache on your machine, with a virtual host for siteiwanttoredirect.com which does a reverse proxy to mysite.com , it should work.
This is handled via the host header of the website, and not anything on your local machine, like your hosts file.
I would make sure your host has that set up, then as long as people visit your sit via the website name, and not IP, everything should work.
On a shared host, the website you get is determined by the domain name you ask for thanks to the Host HTTP header. For this to work properly the web server needs to be configured correctly so it knows what website to serve in response to which Host request - this is usually called 'Add-on Domains' on CPanel driven shared hosting.