Access two sites hosted on my IIS server with the same port? - iis

I currently have two websites hosted on my IIS 7 server. Each website has its own host name but shares the same port (80).
Everything works great locally to access the two sites:
Site #1: http://localhost/ -> http://arcadiastudio.ch
Site #2: http://webService.ch/
But from the outside I cannot reach my second website hosted on the same port. I do not know what to put in the URL:
Site #2: http://arcadiastudio.ch/??
Here is what I have in my host file:
127.0.0.1 localhost
127.0.0.1 webService.ch
::1 localhost

This should be very simple. All you need to do is to have each hostname specified in your hosts file. In your case, your host file on your local PC should look like:
127.0.0.1 localhost
127.0.0.1 webService.ch
::1 localhost
127.0.0.1 arcadiastudio.ch
And the hosts file on your remote PC should look like:
127.0.0.1 localhost
<remote_ip> webService.ch
::1 localhost
<remote_ip> arcadiastudio.ch
Obviously, you need to change <remote_ip> to the IP address of your web-server.
Also, if you want to allow any remote PC to connect, you will need to register your domain names for DNS - you can't edit every host file in the world!!

Related

Website works remotely but not on the server itself when called by domain

I am using Windows Server 2019 and in IIS 10 I have created a website and I have bound it to both: "localhost" and "mydomain.com" on port 80.
mydomain.com works correctly from any client but on the server only when I call "localhost" it works otherwise I get the following error (when called by domain):
Configure your DNS in your local server to resolve the domain name as localhost
On clients, your request domain.com is resolved by its configured DNS.
It can be on public DNS (internet) or private ones (company, intranet).
From the server domain.com, do you have access to the same DNS than your clients use ?
If not, either configure additional DNS servers :
https://serverspace.io/support/help/configuring-a-dns-server-on-windows-server-2012-or-later/
or you could edit you Host file of mydomain.com (local DNS):
C:\Windows\System32\drivers\etc\hosts
It may look like that :
127.0.0.1 localhost
127.0.1.1 mydomain.com
# and existing settings

Why do I have to change the linux host name for postfix?

I am trying to install postfix on my debian server. This is kind of a "general purpose" machine.
The server is running an apache web server and a couple of applications in docker containers. I would like to add a postfix mail server. Every tutorial tells me to change my hostname to mail.mydomain.com, but as I understand the hostname applies to the entire System. This is not primarily a mailserver so I would prefer not to commit to a hostname for the mailserver only.
What is the purpose of naming my host mail.mydomain.com?? Apache works fine without naming the system mydomain.com.
Am I meant to have a separate machine for my mail server? Or should I try to put it in a docker container?
Actually no need to change the hostname. You will add an FQDN so that services like postfix can use it.
let's say your /etc/hosts looks like this:
127.0.0.1 myhostname localhost localhost.localdomain
::1 myhostname localhost localhost.localdomain
set the FQDN to make the hostname be an alias for it:
127.0.0.1 myhost.domain.com myhostname localhost localhost.localdomain
::1 myhost.domain.com myhostname localhost localhost.localdomain
Then you can verify by hostname --fqdn
myhost.domain.com
While hostname is same as before myhostname

can't telnet via IP but can via localhost

I started an instance on AWS ec2 and am trying to connect via my web browser to the app on the server running on port 3000. I've also turned off iptables...
I can telnet via telnet localhost 3000 and telnet 127.0.0.1 3000 but can't telnet via the hostname or ip like telnet ipaddress 3000.
When i do that, I get a connection refused. I think this has somethign to do with my hosts file but can't figure out what. My host file looks like this:
127.0.0.1 ip-108-205-72-168
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost6 localhost6.localdomain6
Provided that you gave the instance a public ip, have you checked the security groups? AWS security groups are associated with instances and apply inbound/outbound rules.
If you have already done that then my next step would probably be to make sure that the port is bound to the correct interface(s). ss -tupan | grep 3000
please make sure you iptable rules is right and can accessed by ip.
Could you confirm whether you using elastic IP over the amazon VM?
If yes, then it will do the entry in the host file automatically when you associate elastic IP to the EC2.
But if not, then need to do a manual entry.
Thanks,
SIM

How to configure apache in local development in rails

I am trying setup a loacl domain on my pc for that I have apache server install I want to open my rails s inside this abcd.com instead of 127.0.0.1:3000. In my host I have changed host file like this:
127.0.0.1 localhost
127.0.0.1 abcd.com
But when I am trying to open abcd.com with this command I am getting this message:
Address already in use - bind(2) for "127.0.0.1" port 80 (Errno::EADDRINUSE)
When I stop apache it works on localhost any help
You need to write all hostnames behind the ip like this :
127.0.0.1 localhost abcd.com

Webmin local development with name based virtualhosts

Hi i am trying to name based virtual hosts for my localhost.I was using wamp with name based virtualhost before but now im working on ubuntu.I thought webmin can be easy but when i create first virtual host all requests redirecting first virtual host even localhost,second virtualhost and phpmyadmin.
So how can i set webmin for reach each of them separately.
hosts config
127.0.0.1 www.adres1.com #working fine
127.0.0.1 adres1.com #working fine
127.0.0.1 www.adres2.com
127.0.0.1 adres2.com
Its because you are using a local server and your all domain will by default search 127.0.0.1 or your IP. So untill you declair them as CNAME in your zone file or do a entry in host file, they all will work as alias of a single domain. Thanks... :)

Resources