How to configure apache in local development in rails - linux

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

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

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

Windows 8 dns hosts file not doing what it is supposed to

I changed my hosts file at:
C:\Windows\System32\drivers\etc\hosts
to
127.0.0.1 localhost
127.0.0.1 www.david.com
everything else is commented with #
I clean the dns with ipconfig /flushdns
However when I put on my chrome browser www.david.com it does not go to my localhost.
What am I doing wrong?
I also tried to ping the server but it does not ping my localhost.
You are not supposed to use the www in the hosts file.
Your hosts file should look like this
127.0.0.1 localhost
127.0.0.1 david.com
When you change the hosts file you need to restart the dnscache service like this
Launch a Windows command windows using the 'Run as Administrator' menu option and then do
net stop dnscache
net start dnscache
Then use david.com in the browser.
For some reason the www. is ignored even if you add it.

Apache IP address working but localhost does not

I downloaded Apache2 and it is currently running. I typed in my IP address and it brings me to the "It Works!" page, however when I type in localhost or 127.0.0.1 I receive an error. Can someone tell me whats up?
check 127.0.0.1 able to ping or not with same machine.
check /etc/hosts file having 127.0.0.1 entry or not?
check in apache configuration file Listen 0.0.0.0:80 or not?

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

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!!

Resources