Is there another way to demonstrate 127.0.0.1 page - hosts

I'm editing the hosts file by say adding 127.0.0.1 somesite.com
When I am navigating this site (somesite.com) access to this site will be blocked.
Can I actually edit the info which will be shown in browser when it is blocked?

127.0.0.1 is the loopback address, meaning that it will attempt to open port 80 on the local machine on which the host file resides. If you want to customize the page that is displayed then you will need to install a webserver of some variety on the same machine.

Related

Why the error "Forbidden" "You don't have permission to access / on this server." is appearing after installing wampserver2.2d on Windows 7?

I just downloaded wampserver2.2d-x32.exe from source forge and installed on my machine running on Windows 7 operating system.
The setup went well. Now when I started wampserver the W icon has turned Green but when I click on localhost link I get following message in a browser window :
**Forbidden**
You don't have permission to access / on this server.
Even I tried to check phpmyadmin by hitting the link http://localhost/phpmyadmin then I got following message in a browser window :
**Forbidden**
You don't have permission to access / on this server.
Can someone please help me in resolving these issues?
Thanks.
The problem is probably that your browser is using the ip address ::1 the IPV6 localhost address and WAMPServer 2.2d (being rather old now) was released before IPV6 was normally available on Windows Boxes so the httpd.conf does not contain this ip as a valid ip.
So first change the httpd.conf file like this ( use the menus to edit httpd.conf)
Find the Listen parameter it probably looks like this
Listen 80
Change it to
Listen 0.0.0.0:80
Listen [::0]:80
Then look for this section
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from localhost 127.0.0.1
And change it to
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from localhost 127.0.0.1 ::1
Now check the C:\windows\system32\drivers\etc\hosts file and make sure you have at least these entries in it
127.0.0.1 localhost
::1 localhost
To correct phpMyAdmin you will also have to edit the \wamp\alias\phpmyadmin.conf file in the same way, as phpMyAdmin is secured seperately in WAMPServer.
Edit \wamp\alias\phpmyadmin.conf
Look for this section :
Order Deny,Allow
Deny from all
Allow from localhost 127.0.0.1
And also add the IPV6 localhost address like this
Order Deny,Allow
Deny from all
Allow from localhost 127.0.0.1 ::1

cant reach asp.net page on other server

I have defined an asp.net mvc app on server x. I added the sitename in the hostfile:
127.0.0.1 weeral.com
Also in IIS 7 i have added this as a sitebinding hostname weeral.com
When I hit http://weeral.com it responds find on the server.
However when I ping weeral.com from a different machine in the network it goes:
Ping request could not find host weeral.com. Please check the name...
what am i doing wrong?
The different machine doesn't have the same host file.
You need to map 127.0.0.1 to weeral.com on every one of the machines you use. If you used Dropbox (or something similar) you could symbolically link the machine's host file to the one in your Dropbox. I've done this for other config files, so I would think it would work for the host file.

I can't see anything while running Rails server or Node server

I'm in a big problem, I can run my Rails or Node servers, but when I look into the browser, Chrome tells me that can't acces into localhost page.
I tried modifying the hosts file in C://Windows/System32/drivers/etc/hosts
I have removed the comments to:
127.0.0.1 localhost
::1 localhost
But nothing happens, when that lines are in comments Apache works, but not Rails or Node.
I don't have any proxy, I triedd with differents ports, and I don't know what else to do.
I would appreciate any advice

How can I demo a website at localhost:3000 but make the address bar show http://mysite.com?

I'm going to be demoing a website I've developed. I want to run it locally but make it look like it's running on production.
This means I'll be interacting with the local web server on my computer at http://localhost:3000. Is there a convenient way I can actually make the browser's address bar look like http://www.mysite.com/ instead of showing localhost though?
Add a hosts entry mapping mysite.com to 127.0.0.1. (and remember to remove it later)
There's not much you can do about the port, although you could host the whole thing in an <iframe> running on port 80.
Or you could just change the port of the demo, which shouldn't be too hard to do.
Not unless you can run the server on localhost:80. If you run on port 3000, the best you can do is to make your local machine think www.mysite.com is 127.0.0.1 by adding:
127.0.0.1 www.mysite.com
to your hosts file (/etc/hosts or C:\Windows\system32\drivers\etc\hosts). If you're happy with http://www.mysite.com:3000/, you can leave the server on port 3000.

Mongrel server trying to perform GET on 127.0.0.1

I've recently started a Rails 3 project which I checked out from github. The application uses subdomains to access accounts so I had to perform a small change in my etc/hosts/ file so that the app navigates properly. I'm now trying to login to the app but am seeing a very strange request in the terminal:
Started GET "/session/new" for 127.0.0.1 at Sun May 08 13:48:38
I'm using the mongrel server and its running on ip 0.0.0.0 so I can't figure out why the app is looking up 127.0.0.1. I'm on OS X so ive stopped my local apache server too.
I've removed all traces of the string "127.0.0.1" in my app but still see the request being made to that IP.
Does anyone have any idea's as to why this is happening?
EDIT: Hosts file is as following:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost ger.mpt.local
255.255.255.255 broadcasthost
#::1 localhost
#fe80::1%lo0 localhost
EDIT: I should also mention that I get a 302 redirect status from firebug when I submit the login form.
Thanks,
gearoid
Mmm. 0.0.0.0 means that Mongrel listens on every IP address "associated" with your system, including localhost (localhost is defined as an alias to 127.0.0.1 everywhere).
The answer to this lay in the session storage configuration.
After debugging through the code I could see that the session wasn't being made readily available to various authentication methods. Upon deeper inspection I found a config file which set the domain which the session is picked up from. Setting that to "mpt.local" allowed the session to get picked up and thus allowed me to login.

Resources