IIS sites can be viewed with http://localhost:port but not with local machine IP or loopback - iis-8

I have googled this and found a lot of posts, but no definitive answer.
Basically, I want to play with making websites and set up a local virtual server with only IIS (v8.5) installed. It's not connected to the internet and it's purely for self education.
The problem is that I have sites working, different sites on different ports. All of these are viewable in a browser on the server if I use http://localhost:port-number as per the site's binding.
I can live with this - but I'm curious as to why, if I substitute the localhost with the server IP, or the loopback address the page can not be found. Clearly IIS is working as it serves pages with localhost.
I have added multiple bindings to a site so that 'all unassigned' the server ip and the loopback are bindings for the site on port 80.
As per some posts I've used CMD to add netsh add iplisten.
netstat - confirms the server ip is listening on all the ports of the websites created (3 sites, each with a different port number)
Firewall is disabled as it's only virtual server with no internet access.
I'm aware I can add a domain address and put this in the hosts file, but I'm really just curious as to why I can't browse the sites hosted in IIS locally by the server's IP or loopback.
Thanks in advance

Related

Accessing localhost (xampp) from another computer

First, I already searched stack overflow and followed the suggestions in previous answers, such as How do I connect to this localhost from another computer on the same network?
I have created a PHP/MySQL application for a client. The want to host it locally on that server.
The machine in question is running an application written in another langauge (I'm not sure which one) and running Tomcat on port 8080.
They also do not have separate staging/production environments, so this is not ideal.
Their other web application needs to remain running while I also port over the new app. I installed XAAMP onto their system and got the app running locally using Apache HTTP. However, they want other computers both within and outside their networks to be able to connect to the Windows server as well. They are already doing this for the previously created app that is running on Tomcat.
Ports 80 and 8080 are already being used, so the firewall was updated to allow my application to run on port 8086.
I used ipconfig to the find the local IPv, and then tried updating the http.conf and vhost file and am listening to the IP on port 8086. However, going to the IP/foldername doesn't resolve on another computer in the network. As a test, I also just typed in the IP of the windows machine, and it never resolves.
I generally don't implement of windows; until now, all of my production applications have run on some flavor of unix. Their other application is live and I don't want to disturb it. They access it by going to {servername}:8080. I tried server:8086 to see if my app could be accessed that way, but it can't.
I confirmed that localhost/foldername resolves.
Here are the exact steps that I have taken. I tried two different solutions.
Solution 1, using How do I connect to this localhost from another computer on the same network? as a guide:
Make sure firewall allows port 8086 access
I modified the C:\xampp\apache\conf\extra\httpd-vhosts.conf file to include a virtual host for the application:
DocumentRoot "C:/xampp/htdocs/{foldername}"
ServerName dispatchserver
Went to the Windows host file located at \Windows\system32\drivers\etc\hosts and added the following:
192.xxx.x.xx dispatchserver
From a computer outside the network, tried to go to the following URLs (non resolved):
http://192.xxx.x.xx
http://192.xxx.x.xx:8086/
http://192.xxx.x.xx/foldername
http://dispatchserver
http://dispatchserver/foldername
Since they didn't work, I tried a solution using this older stack overflow answer: Accessing localhost (xampp) from another computer over LAN network - how to?
Made sure firewall allows port 8086 access
XAMPP control panel > Config > Service and Port Settings > Apache > Changed main port to 8086.
XAMPP control panel > Apache > Config > http.conf
Searched for "Listen 80" and replaced with Listen 8086
Right above that, added Listen 192.xxx.x.xx:8086 (I used the IPv4, but don't want to include full address for security reasons). I added this line with hashtag at first (#192.xxx.x.xx:8086) and then without hastag after that didn't work (192.xxx.x.xx:8086).
Searched for and set this up as the directory statement:
AllowOverride All
Require all granted
Restart Apache
What steps can I take to allow the new webapplication I installed via XAMPP to be accessible to other computers?
In that case it's a little different if you want to web enable this. You need to set up your router to port forward to your server (app)so that the other network can reach it from the internet. Your router blocks incoming requests by default so a port forwarding rule using the port you mentioned will work. You should also put your server computer (the one with the app) on a static ip address to make things easier. Then for the user to see your app you need to give them the ip address of your internet connection (seen via sites like ipchicken.com) and the port number in the url.
Normally you just need to open the ports in the windows firewall on both computers (inbound and outbound) for the ports your application is using and then connect to the other machine via ip address and port number if they are on the same network.

Directing Domain Name to Tomcat

I am developing web pages and deployed it in Tomcat. I want it to share among my friends. I read about IIS and Apache.Please suggest me any way to direct domain name to tomcat installed in my computer.
Personally, I would stay away from IIS.
Deploy an instance of Apache/HTTPD in windows - and proxy/reverse-proxy the traffic on whatever port you want to your tomcat instance.
You can find some decent resources as for Windows deployables here:
https://httpd.apache.org/docs/current/platform/windows.html
Then when you have your server set up and functioning, look into the ProxyPass directive within Apache.
https://httpd.apache.org/docs/current/mod/mod_proxy.html
Don't forget to open a port forwarding on your router, if necessary.
As far as directing your domain name to your computer, look into getting an account at ZoneEdit to set up your DNS to point whatever domain name you want to your routers/cable modems IP address. Then you can set up your port forwarding.

how to use IIS and website hosting

I am new website servers and hosting and just after some help clearing some stuff up.
Firstly if I use a website server on my computer ie. IIS is that the same as using a web host such as host puppa? and if so does that mean I don't need to use a web hosting company?
Secondly what hosting/ server do i need to use to run SQL and MySQL in my website?
Is there any good tutorials that run through all of this stuff for beginners as I am quite confused?
IIS is a web server such as apache or nginx. It's a Microsoft product and supports ASP.NET pages.
You can use it instead of a web host, but you have to make sure that your computer is reachable from the internet if you want global access. There is also some setting for what interface and port you want IIS to listen on, that should be set to your external IP address and port 80 for HTTP.
If you are behind a router with NAT, you have to use port forwarding to redirect port 80 requests to the router into your IIS.
As SQL server you can use Microsoft SQL Express or MySQL for example.
Personally, I use WAMP on Windows machines, which gives me everything I need: Apache, MySQL and PHP.
Furter reading: http://www.howtogeek.com/177129/beginner-geek-how-to-host-your-own-website-on-windows-wamp/ (wamp only, but I mentioned alternative applications above)
Edit 1: If your ISP gives you dynamic IP addresses (which is the common) you have to use some kind of dynamic DNS updating, you IP address might change.
Also, of course, if you shut your PC down, the site goes down as well.

how to access local web application on glassfish server from internet?

I have created a web application in glassfish and I can access it on my LAN.
How can I access the web application from a remote location over internet?
I do not have static IP.
Please reply.
Thanks.
Steps :
Creating virtual DNS(Domain name server) Server on your machine.
Port Forwarding.
Reference https://cookbook.fortinet.com/port-forwarding-60/
Remote Desktop Connection enabling.
Creating Inbound Rules. Reference :
https://www.howtogeek.com/112564/how-to-create-advanced-firewall-rules-in-the-windows-firewall/
Creating account on www.noip.com and create custom host and download DUC (Dynamic Update Client) Software.
Some more steps may have it depends on your LAN Router and firewall configuration.Use http://ifconfig.me/ to get your public ip.
Access from outside your machine should be configured by default. You may check if it is so in admin console, at Configurations->server-config->Network config->Listenters. There should be one listening on the desired port (like 8080) and be bound to 0.0.0.0 address.
To easily access something behind a dynamic ip you need something like http://www.noip.com/ or http://www.dnsomatic.com/ (I took these from my router's control panel)
I did this recently,
first you need to use port forwarding on your router, access it by typing your default gateway path, mine was 192.168.0.1 then go to "advanced settings -> Port forwarding". Simply enter the details that are asked for, I set mine to HTTP using port 8080, yours might be different. Protocol is TCP. The IP address it asks for is your local address.
For quick testing you can disable the firewall on your machine and then you can search on google for your Public IP address by typing "what is my IP".
Then type your ip into the browser and the port number "ipAddress:portNumber"
You should see the glassfish welcome screen if it is successful.
After that you might want to enable your firewall again but then you have to add an inbound rules to allow the port to be used:
Setting Windows inbound rules
Then you still have one last step to perform, allowing glassfish to access the resources on your machine: Adding glassfish to allowed programs
Follow the instructions on adding java.exe only.

How to set up an internal website?

How do I set up a website that's accessible within a small (office) network? I've only worked on localhost (using WAMP) so far and have no idea where to start. Also, is it possible to access that website through a pseudo domain name/alias instead of an IP?
This is of topic here - and wil be covered by lots of basic set up tutorials.
It's exactly the same process, except you need to ensure that clients on the lan can connect to the webserver runing on port 80 - i.e. make sure your firewall isn't blocking the access and that apache is listening on the LAN interface address (the default configs are usually to listen on all addresses).
is it possible to access that website...
Yes - just publish a DNS record for the webserver in your DNS server - or add it to the hosts files on all of the clients.