Windows hostfile using https? - https

I'm trying to do a few mappings of my local network. so far with great success, but now im trying to access a part that is using http, and have so far not been having any success for that
Ive tried https://192.168.1.11 unifi
Is there a way to add https:// and ports
like https:192.168.1.11:8443 unifi

The host file exists only to map hostnames to IP addresses. It knows nothing of HTTP and ports which would be handled by the server running at the IP address you are pointing to.
To map the hostname unifi to 192.168.1.11 your entry would look something like:
192.168.1.11 unifi www.unifi
And you would access port 8443 via HTTPS by going to https://unifi:8443 assuming the server at that location is set up to handle the request.
https://en.wikipedia.org/wiki/Hosts_(file)

Related

Different port make the DNS useless

I use XAMPP to make a website but I have the other Website use IIS so I couldn't use port 80. So I use port 8888 at XAMPP Apache for Windows OS.
If I type HTTP:/URL (my IP):8888 I could link the website, but when I use the DNS name such as shop.example.com.tw(just example).then It's not work.
I know it need to set virtual host and name base
but the default document is use port 80
How could I make the shop.example.com.tw work by port 8888 and the client-end
don't need type shop.example.com.tw:8888
Domain Name Services (DNS) only links a (sub-)domain name to an IP address, it does not deal with IP Ports.
So the part you have listed as "URL (my IP)" would be replaced with the domain name, e.g. "something.mydomain.com". You need to still put the port number on the end because you are directing your client browsers to a non-standard HTTP(s) port. The standard ports being, of course, 80 for HTTP and 443 for HTTPS.
If you want to direct a local port to a standard one externally, you need "Port Address Translation" (PAT) which is commonly available on routers. Or you need a proxy that will do the PAT for you.
Both Apache and IIS can do such redirections.
So the transformation is done in two steps:
http://sub.domain.com:80 --> http://1.2.3.4:80
http://1.2.3.4:80 --> http://1.2.3.4:8888
DNS takes care of the first, PAT or Web Server configuration or proxy server takes care of the second step.
Below are some examples for Apache. Note that personally I no longer use Apache as I find NGINX more performant and better to configure.
Apache redirect to another port
http://www.ubergizmo.com/how-to/how-to-set-up-port-forwarding/

Why does HTTPS break my hosts file redirection?

There is a machine (let's call it Machine) with a hostname in my local network. If I go to abc.def.com, my DNS service resolves Machine's external IP and connects me successfully with https://. I've added a hosts file entry so that local.abc.def.com resolves to Machine's local, internal IP.
However, using https://local.abc.def.com breaks everything. I get ERR_CONNECTION_REFUSED in Chrome and This page can't be displayed in Internet Explorer. If I replace https:// with http://, it works again. What's going on?
I assume, for your abc.def.com machine you have https redirect configured with 443 port as well.
Based on description above your application/web server you are using
is not listening port 443 or there is a firewall rejecting your connection.

Hosting Website to local in IIS

I am able to host website in IIS 8 but not with ip add. The binding with ip and browsing the site in chrome gives 'ERR_NETWORK_ACCESS_DENIED'
http://localhost - works
http://10.111.148.133/ - does not work.
Seems you are using your public IP.
You can browse using your local IP address. Your local IP address should be some thing like 192.168.xxx.xxx .
You can check your local Ip address using the following command in command prompt.
ipconfig/all
if you want to access your site using public ip, then you need to port forward from your public IP to localIp by setting the DMZ Host in your router.
Along with the above answer, try going through your Firewall settings on the host computer and enabling anything related to IIS or port 80.
You can easily figure out if your antivirus or firewall is the issue by temporarily disabling it.
However, I think your issue is that you grabbed your public IP address, off whatsmyip.com or something, you just need to exec ipconfig to see what your local IP is.

Do we have to buy a domain to serve Bugzilla?

I tried putting my IP from whatismyip.com in the urlbase of Bugzilla but it did not work. I wasn't able to create a new account for my team mate, and he wasnt able to access the server by typing the my ip address in his browse. And surely, when I connect again, my IP address will change. Do we have to buy a www address to host Bugzilla?
You can setup a dynamic dns service, for example via http://www.dyndns.com or http://www.no-ip.com or http://freedns.afraid.org to solve the changing ip problem without buying a domain (or buying a domain as well, but it's not a requirement).
But the real problem is that your team mate cannot access the server via the current IP address which points to either a misconfiguration of the webserver (listening only on localhost?), to a firewall in between, or most likely, that port forwarding isn't set up in your router for requests coming to your external IP address to be forwarded to the machine where you have Bugzilla set up. Additionally, you must set the urlbase to your local IP address, not to the external IP address, as blak3r says.
Check http://www.portforward.com for instructions on how to do port forwarding. But don't forget that everything mentioned has to be working:
Web server listening to outside requests: This can be tested from the same internal network via the local network IP address (what you see typing in a command line console ipconfig in Windows and ifconfig in Linux). If you can connect from a different machine on the same network via the local IP address, this is solved.
Firewalls (in router and the webserver machine) accepting connections to the web server port: For firewalls in the web server, the same test as above covers it.
Port forwarding so the router forwards the requests received on the web server port to the web server machine: This gets tested in the same way as firewalls in the router, that is, you must have your friend (or yourself from the house of your friend) try to connect to the dyn dns name set up or to the external IP as reported by whatsmyip.org.
This is all assuming your test mate is not on your same network, if he is, just using the local IP address (shown via ipconfig or ifconfig) instead of the external IP address and making sure the first step is covered (web server listening to outside requests) should be enough and nothing else is needed!
You most likely do not have your port 80 forwarded to your machine which is the reason he cannot connect when using the IP that was returned from whatismyip.com.
Assuming you're on a windows box... do
Start->Run->cmd then type
ipconfig
If your address starts with 192...* or 10...* this is your Local Area Network (LAN) IP. If this is the case, then your isp provided you with a router. Look for a setting called port forwarding or "application setting" which allows you to forward all incoming traffic on your router to a particular IP address. Go into your router's configuration settings and make sure port 80 (and maybe 443 if you're using ssl are forwarded to your local ip).
The other problem you mentioned is you do not have a static IP. This is a common problem and no you do not need to buy an address. There are several sites which can provide you a free dynamic dns host. Try no-ip.org.

Difference between specifying IP in host file vs using IP directly

Is there any difference between the following when a intranet URL in accessed in IE
Add an entry in drivers/etc/host file for a name and IP
vs
Use IP directly
e.g. it works with the following link if I have a host entry as (XYZ 10.0.10.200)
http://XYZ/SiteDirectory/ABC/Default.aspx
but when I tried to use IP instead of name
http://10.0.10.200/SiteDirectory/ABC/Default.aspx
It gives me 404 not found error
Yes, there's a difference.
The web server is using HTTP/1.1 and "shared virtual hosting". When the client connects it sends an additional Host: header which contains the hostname part of the URL that the user supplied.
The web server looks at the header to find out which virtual host's data to serve.
In this case, the web server is configured to recognise and serve content from the "XYZ" domain, but doesn't know about any domain called 10.0.10.200
Smells like the webserver is using virtual hosts, so that it serves different pages if the client went to "www.foo.com" or "www.bar.com", even though they have the same IP-address.
As far as I can see there should be no difference. With a host name the order is hosts file before DNS so it should be used.
Is there another line in the host file with the same hostname?
What happens when you do a tacert? (trace route)

Resources