Unable to access website added in hosts file in MAC OSX - macos

I have added a hostname in the /etc/hosts/ file in Mac OSX,when i try to run the URL with the hostname in the browser i couldn't able to access it , but when i try to access it with IPAddress I could able to access it.
Observations:
1)I can able to ping both IPAddress and hostname added to /etc/hosts file
2)I can able to access the URL with IPAddress but not with hostname
3)I tried flushing the dns Cache with following command
dscacheutil -flushcache
4)I can able to access URL with hostname in windows machine.
So I appreciate any suggestions about what might have gone wrong....
Thanks in advance....

Related

ssh login in ec2 to change file permission

I need to login in the ec2 aws server to change the file permission. I've .pem and .ppk file on my server and gitbash installed.
Please guide me how can I login to the server and change the file permission.
Here the official documentation from Amazon with SSH/Putty tutorials to connect to your instance: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstances.html
(But assuming you are using Unix/Linux OS)
You could log in to the ec2 instance with the command:
ssh -i /route/to/your/file.pem user#serverUrl.com
(if you have public Url or in your /etc/hosts file or with your IP)
Then, you are logged in the EC2, you could cd to the desired folder and change the permisions with a chmod.
In the /etc/hosts file, you could change the IP of your instance for the serverUrl.com like:
XX.XX.XX.XX serverUrl.com
Hope this helps!

Access to localhost in virtualbox

I have a server on port 8085 (my pc - I use Ubuntu 16.04). There are also Virtualbox with installed Windows 7. I have an internet connection in Windows (it is possible to open google.com etc) but there is no connection to localhost. For localhost:8085 in Ubuntu everything works perfectly but for the same adress in virtual-machine doesn't work.
I tried to modify Settings->Network and put there bridged but there is the same problem.
How is it possible to access it?
Try 127.0.0.1 instead of localhost
or get ip address with terminal command ifconfig and use the address in the url

OSX SSH tunnel from remote port to local

I've created SSH tunnels in the past, but I'm having trouble on OSX. I'm looking to take a website's port 80, and direct it to my localhost:8080. When I run this command
ssh -L 8080:<cloud_ip_address>:80 root#<cloud_ip_address> -N
I get the default apache 'it works!' page.
Why am I not getting the port 80 of the remote machine (which is running a web app)?
UPDATE
I still do not have a solution yet, but I have some more information. The page I am getting is the default page in /var/www/html but I am serving a Flask app which does not have static pages.
Because HTTP protocol contains not only the IP address, but also the hostname (the URL you type into your browser), which differs between the <cloud_hostname> and localhost. The easiest way to trick it is to create /etc/hosts (there will be some OSX alternative -- search ...) entry redirecting the hostname of your remote machine to localhost.
127.0.0.1 <cloud_hostname>
But note that in this case you will not be able to access the remote machine using the hostname!

Accessing remote server service via HTTPS

I have a server(AWS) to which I have ssh access.
There is a service(supervisor) running on this service on port 9001 whose web view can be accessed through 127.0.0.1:9001 had it been a local machine.
But since it is not a local machine, how do I access it?
I got the ip address of the machine using ifconfig | grep inet and then tried accessing it through https://172.11.11.1:9001/
Bit dint work.
When I tried wget https://172.11.11.1:9001/ it shows
Connecting to 172.31.19.8:9001... and hangs there.
I have added the following line in my supervisor conf file.
[inet_http_server]
port = *:9001
Can someone please help me with this?
This is more of a server config question. You'll most likely find your AWS access properties allow connections on post 22, 80 and 443 only. In AWS console you'll need to add a new security access group to allow port 9001 to be accessed.

Point Vagrant to a Local API

Hey guys I have two vagrant machines running, one is the app code base and the other is the api code base for the app. I want to be able to do a curl call from my app machine to the api machine.
On my computer I can call both because I have them in my etc/hosts file, but what do I need to do to successfully request from vagrant to vagrant.
I tried to go into my app vagrant machine's etc/hosts and add the domain with the 127.0.0.1 but no cigar.
So it turns out that Vagrant makes your guest machine's ip to 10.0.2.2. So what I did on my App code base vagrant machine. I edited the /etc/hosts to;
10.0.2.2 api.local.com
previously I tried 127.0.0.1, and that didn't work, so I just checked the apache access logs saw the ip and gave that a whirl. and that worked.
On my local machine I have;
127.0.0.1 api.local.com
I hope this helps.

Resources