How to use domain name instead of local host IP with PHP - dns

I'm experimenting some PHP code with a local IP address http://192.168.33.10.
When I was using the address in a form of number (192.168.33.10) it was working fine (see image 1), but when I try to use a domain name "dev.dotinstall.com", it reaches an error page (see image 2).
I learned that you can use a name like "dev.dotinstall.com" instead of IP address by editing hosts file, so I edited it adding a line "192.168.33.10 dev.dotinstall.com" at the end of the hosts file (see image 3).
The error page says "The fact that you are seeing this page indicates that the website you just visited is either experiencing problems or is undergoing routine maintenance.", but I don't know what the problem is.
Any idea why this is happening?

You are correct that you need to add the URL into the hosts file. Make sure you have saved it correctly (with administrator rights) and the port is correct.
This is not enough though, you will need to set up a virtual host for Apache as well and then restart Apache. If you only set the URL in the hosts file, then Apache will not know what to do with it. There are plenty of materials on setting up a virtual host for Apache on Windows if you search for that.

Related

how to use customized website name instead of IP Address on IIS

I developed an Application locally with Angular-7. Eventually, I deployed it to the IIS of a VPS server with IP address 20.20.20.20 (not the real IP). When I run the application as 20.20.20.20, it works perfectly.
Now I want to access the Application with customized name (ePortal). So on the IIS of the VPS server, I made the Host Name to be ePortal. When I typed http://jPortal on the browser url, I got an error that the page cannot be displayed and the url does not exist.
How do I resolve this?
If you want to see your desired name on your local computer only please go to
c:\windows\system32\drivers\etc
And open hosts file using note pad having admin privilege.
and add your IP And your desired name to file and save it.
Now you can browse your server by the name you defined.

access previous site after DNS change

because of some background issues we have to change webhosting. unfortunately after the change I have found that we did not backup one file. We have no access to ftp server or any access to previous hosting. Only available way was via http and public access.
The domain is spedimex.cz, now running on new hosting with new dns etc. I thought that if I search for previous records and try to access the site via IP address I will be able to gain desired file.
History was gained from here
https://dnshistory.org/dns-records/spedimex.cz
but when I try to access A record 46.28.50.165 it says that page does not exits. Any tips how to access previous data?
thanks for tips!
Use hosts file. On linux is usually at /etc/hosts.
So you write on the last line
46.28.50.165 spedimex.cz
(if I understood correctly), then go get the files, then restore the hosts file.

Hosts file not working properly

I have a site on my test machine I want to bind into IIS with hosts file.
It's not that I haven't done it before, but this time the page is blank when I load it and chrome says the web page is not available.
In the dev tools Network tab I get ERR_NAME_NOT_RESOLVED and the weird part is that I've entered a domain name in hosts file associated with 127.0.0.1 address. The same site loads when I add virtual directory and access it via localhost.
UPDATE
Screenshoot of the web site, bindings and dev tools network tab.
http://oi59.tinypic.com/6zsfau.jpg
I have also tried loading with Firefox and IE, but same results.
Have no idea what might be the problem.
Here's 3 options I can think of:
Check that your binding in iis is set to "All Unassigned" for the IP address (displays in IIS as "*")
Alternatively bind to a specific ip address and use that ip address in the hosts file
Check that your hosts file encode in ANSI
hope this helps

accessing a webpage stored on a home server

I am running a raspberry pi using raspbian linux. I have apache web service installed and when i type in my ip address into the address bar of a browser it loads the default apache webpage saying it all works.
I have another folder located in home/Client5 on this device from which i am trying to load an index.html page but i am recieving a 404 not found error. eg
192.304.0.22/home/Client5/index.html
Not Found
The requested URL /home/Client5/task5.html was not found on this server.
I gather that theres something wrong in the above web adress or is it that i have to place this folder within the apache folder?
You have two solutions.
1/ If you want to keep the default apache pages, add a virtualhost (there are tons of docs on this, I don't think it needs to be repeated here).
2/ If you don't care about the default apache pages, edit /etc/apache2/sites-available/default and change DocumentRoot to make it point to /home/Client5/ . Add an index.html file in there, hit the Raspberry IP in your browser, you should see your page.
You might need to chmod -R ugo+rwX /home/Client5.
I don't know what you have under /home/Client5, but if it's a regular user, this setup is highly insecure. There are a bunch of additional steps to take if you want to host under home directories (first step, don't put pages in $HOME but create a subdir). It is safer to have a dedicated place with proper perms outside home dirs unless you really know what you're doing.
Is it working in local ? (XXX.XXX.X.XX:80) ? Surely yes, so take a look at your router.
If you have apache2, you local ip indicate to folder '/var/www/'.
If you want host page in '/home/Client5' you have to make virtual host :)
#edit
Read about it here

IIS: Can I create a host header for an intranet site?

This is a fairly simple question (in my opinion) but for some reason despite my Googling I cannot find a straight answer to it.
Currently I have an application running under my Default Web Site located at http://localhost/myApp. Ideally, I'd like to create a new site in IIS with a binding to 127.0.0.1:80 and a host header of http://myApp so that I can test my url rewriting rules properly (since my app will ultimately be hosted at http://www.myApp.com, not http://www.somedomain.com/myApp).
So, my question is this: will the above work? I haven't had a chance to try it yet.
If the above will not work, what are the steps to be able to access my site at http://myApp on my local network?
It should work provided you fool the OS into resolving www.myapp.com to 127.0.0.1. To do so, edit your hosts file in %systemroot%\system32\drivers\etc to contain the following:
127.0.0.1 myapp.com
I believe you could do just myapp(without the .com) as well, but that gets a bit trickier because how that is resolved depends on your node type. (hybrid, etc) To be safe, add
127.0.0.1 myapp
to BOTH the hosts and LMHosts files in the same directory. By default the lmhosts is non-existent and there is a lmhosts.sam there. You'll have to rename that to just lmhosts or create a new one.
Then create the binding as per usual in IIS7/7.5 (I assume it's 7... Site->Actions->Bindings->Add or Edit->Populate hostname accordingly).. IIS6 will work too but it's alot harder to get https working should you need it.

Resources