Can server host different domain in same port? - web-services

I am trying to understand how to host different apps in server, so can server host different domain in same port.
For example, I have domain1 and domain2 both hosted at port 443. Can this be done?
I am doing this in IIS server.

A single web IIS server can host different domain in same port. However, in order IIS to distribute HTTP requests correctly, each website has to be identified with some unique value. In case of an IIS website, it consists of three attributes that make up a unique combination for each website. These are:
a TCP port number
an IP address
a host header (host name)
The information about the hosted websites is stored in the ServerBindings attribute of the IIS metabase in the following format: IP:Port:Hostname. Thus, if you want to host multiple websites on the same port and IP address, you will have to use a unique Host header. What is it? Host header is a part of an HTTP request to the server sent by a client that specifies which website it is addressed to. Accordingly, this host header must be specified on the side of the web server, and the DNS contains the correct record that matches the hostname and the IP address of the IIS web server.
Let’s suppose that you have a website running on IIS and listening 443 port. And you need to bind second website to the same port. In the IIS Manager, create another website with the name TestSite, which files will be located in c:\inetpub\TestSite (do not specify the hostname yet). After you click OK, a warning appears that you cannot use the binding *:443 for both sites.
The binding '*:443:' is assigned to another site. If you assign the same binding to this site, you will only be able to start one of the sites. Are you sure that you want to add this duplicate binding?
Agree to this warning. So you have got another site bound to port 443, you cannot start it without stopping the first site.

Related

Can a remote server send response to a local client on a custom port?

For network gurus out there, I'll like to ask some questions regarding some unique setup where the server will be sending a request to a client on localhost on a certain port.
I have a cloudy understanding of some network fundamentals that I hope you'll be able to help me out.
Kindly check the image below:
Basically, there's a static website hosted in AWS s3 and at some point this website will send a request to https://localhost:8001.
I was expecting that it will connect to the nginx container listening on port 8001 in my local machine, but it results in 504 gateway error.
My questions are:
Is it possible for a remote server to directly send data to a client at a particular port by addressing it as localhost?
How is it possible for the static website to communicate to my local docker container?
Thanks in advance.
In the setup you show, in the context of a Web site, localhost isn't in your picture at all. It's the desktop machine running the end user's Web browser.
More generally, you show several boxes in your diagram – "local machine", "Docker VM", "individual container", "server in Amazon's data center" – and within each of these boxes, if they make an outbound request to localhost, it reaches back to itself.
You have two basic options here:
(1) Set up a separate (Route 53) DNS name for your back-end service, and use that https://backend.example.com/... host name in your front-end application.
(2) Set up an HTTP reverse proxy that forwards /, /assets, ... to S3, and /api to the back-end service. In your front-end application use only the HTTP path with no host name at all.
The second option is more work to set up, but once you've set it up, it's much easier to develop code for. Webpack has a similar "proxy the backend" option for day-to-day development. This setup means the front-end application itself doesn't care where it's running, and you don't need to rebuild the application if the URL changes (or an individual developer needs to run it on their local system).

web service show localhost not IP in SOAP

I created a web service named WildflyTest and a method called HelloWorld and deployed it to my wildfly 11 server,the server ip is 10.10.9.151.I tried to test using SoapUI, and I can open the wsdl address http://10.10.9.151:8086/WildflyTest/HelloWorld?wsdl. But when I tested it in SOAP Ui, when I created a new request, the address is http://localhost:8086/WildflyTest instead of 10.10.9.151.Can anyone give me some suggestion where to check the reason? Thx.
The issue is with your bind address. By default, public interface is configured to listen on the loopback address of 127.0.0.1. So if you start WildFly as: ./bin/standalone.sh
Then the WildFly default page can be accessed as http://127.0.0.1:8080. Usually, /etc/hosts provide a mapping of 127.0.0.1 to localhost, and so the same page is accessible at http://localhost:8080. 8080 is the HTTP port where all applications are accessed.
On a multihomed machine, you may like to start WildFly and bind public interface to a specific IP address. This can be easily done as:
./bin/standalone.sh -b=10.10.9.151 //your server ip
Now the applications can be accessed at http://10.10.9.151:8080.
Refer following links for more info:
Bind WildFly to a different IP address
How to configure JBoss to bind to a different IP ?

AWS host new version of web app on another port?

We have an new version of php web app listening to port 80.
I am wondering if it is possible to host the new version on another port, with no code modification, while keep the old version listening to port 80.
For example, if the user visits the page www.example.com, then it goes to the old version, and if the user visits the page www.example.com:8080 then it goes to the new version.
Maybe I can achieve this with route53? or maybe I have to alter the apache configuration?
Thanks.
The way to achieve this is by tweaking the Apache configuration as you suggested, to force Apache to fetch your content from another DocumentRoot when the 8080 listener is triggered.
Route53 will not help here as a DNS system only resolves name to IP Address, and do not deal with multiple ports for the same IP address.
You can use Apache's VirtualHost to configure multiple listener. You can even have different PHP versions per host ports, as per Running two PHP versions on the same server

Host name site collections, access from different machine

I have created 2 host name site collections
http://site1.dev.com.au and
http://site2.dev.com.au
I have added these 2 entries in host file
127.0.0.0 site1.dev.com.au and
127.0.0.0 site2.dev.com.au
I can access both sites, now I am trying to access these sites from a different machine, both entries have been added to DNS.
I have checked default IIS application running on port 80 is stopped becasue my sharepoint web application is also running on port 80. When i try to access site1.dev.com.au from a different machine I see default IIS page, why is that happening? It should show sharepoint site.
How can I fix this issue.
Do I need to remove entries from host file?
Do I need to add bindings in IIS web application

How do you change the DNS for a website hosted on an Azure Linux server VM?

I have a website running CMSMadeSimple on an Azure Linux VM. The current URL is [website].cloudapp.net/cmsmadesimple, but now that the site is complete I need to change the it to the client's URL [website].com.
I've done this in the past by simply remoting in to the server and changing the DNS records, but since the VM is Linux, I can't just remote it. I've looked around but have yet to find a solution.
What am I missing here?
Just create a CNAME or A record. However, your application server must cooperate by redirecting the request to your new hostname to the existing application. It's likely a VirtualHost is already setup for this but if you get a 404 then you need to "remote" in.
First update the config.php files for the new domain.
Second update your vhost files on your webserver to listen to the new domain.
Final update the DNS (usually it is where you registered the domain -- like godaddy.com, namecheap.com, etc) to point to the IP or alias given to you by Azure.