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

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

Related

ERR_TOO_MANY_REDIRECTS after change .dev domain to .test in /etc/hosts for rails app

I wanted to change development domain to .test from .dev for our rails app after new Chrome update that forces https for .dev domains.
I updated all spots in the app where we were using .dev domain. I changed /etc/hosts file too. It looks like below. I get ERR_TOO_MANY_REDIRECTS error when try access the app in a browser. I see in logs that this request does not hit the app, so it probably fails somewhere earlier. Any ideas how to fix this?
##
# 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
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 example.test
127.0.0.1 www.example.test
127.0.0.1 app.example.test

Is there another way to demonstrate 127.0.0.1 page

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.

Connect Ruby/Rails to ipad via local network

host ip: 192.168.1.2
ipad ip: 192.168.1.3
when working on my host, the web address is: localhost.dev:3000/sign_in/
When I try to connect to my ipad via 192.168.1.2.dev:3000/sign_in the connection times out.
One method to overcome my issue was to change the wifi settings on the ipad to manual proxy:
server: 192.168.1.2
port: 3000
Now 192.168.1.2.dev works! Kinda...
I can now log in to my site, but js seems to be broken and the ipad changes the url to: ( http://2.dev/page ) Normally it would be ( http://localhost.dev:3000/page ) Which I believe is the last digit of the host lan ip. We use some externally hosted js files. Which may be why it is breaking. I can NOT browse the internet (on ipad) while the proxy is enabled. What am I missing?
(192.168.1.2:3000 does not work for any device..)
After further debugging I believe it is because of internet connectivity through the proxy.
The exact error my log spits out is:
CONNECT configuration.apple.com:443 HTTP/1.1
Host: configuration.apple.com
User-Agent: ubd/289.3 CFNetwork/672.1.14 Darwin/14.0.0
Connection: keep-alive
Proxy-Connection: keep-alive
2015-04-20 11:52:54] ERROR TypeError: can't dup NilClass
/home/pete/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httprequest.rb:279:in `dup'
So I think I have to enable linux to forward my internet as well?
Rails is not accessible, because the server binds to localhost.
Here's my usual workflow using zeroconf / Bonjour and Mac OS X, although it should basically work with another OS and / or a fixed IP address, too.
Open System Preferences > Sharing to look up your computer's .local name:
Add the host name to config/environments/development.rb so you access the server by that name, e.g.: (required for Rails 6+ see: Blocked host Error)
Rails.application.configure do
# ...
config.hosts << 'stefans-mac.local'
# ...
end
Start rails server with the -b option to provide the host name (this is the important part):
$ rails s -b stefans-mac.local
=> Booting Thin
=> Rails 4.2.1 application starting in development on http://stefans-mac.local:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
>> Thin web server (v1.5.1 codename Straight Razor)
>> Maximum connections set to 1024
>> Listening on stefans-mac.local:3000, CTRL+C to stop
Assuming you've enabled iCloud Tabs, visit the URL on your Mac using Safari (so you don't have to enter the address manually on your iPad)
On your iPad / iPhone, open Safari, tap the Tabs icon, scroll down and select the Rails tab:
Done:
I'm not sure what Ruby on Rails version you're on but somewhere around version 4, Rails changed the default binding address from 0.0.0.0 to only localhost. By default this allows you to only access the Rails app via localhost:3000 or 127.0.0.1:3000 - which is fine in most cases.
Now if you'd like to access the app from an iPad on your local network (or any device on your local network) you can use the -b option when starting the server and specify a binding address of 0.0.0.0
rails s -b 0.0.0.0
This will bind on ALL interfaces including localhost and the IP assigned by your network. You should now be able to access the app via your iPad. Hope this helps.
If I were you, I would try Ngrok. that way you can temporarily and securely expose your dev machine's localhost:3000 to the ipad. Download ngrok to your application's folder and unzip /path/to/ngrok.zip.
For me that looks like:
unzip ngrok_2.0.16_darwin_amd64.zip
Then run rails s.
Finally ./ngrok http 3000.
This command will give you an address to hit from your ipad. When you're done just kill ngrok with ctrl+c.
I get the following output:
NAME:
ngrok - tunnel local ports to public URLs and inspect traffic
ngrok by #inconshreveable (Ctrl+C to quit)
Tunnel Status online
Version 2.0.16/2.0.15
Web Interface http://127.0.0.1:4040
Forwarding http://014da213.ngrok.io -> localhost:3000
Forwarding https://014da213.ngrok.io -> localhost:3000
Connnections ttl opn rt1 rt5 p50 p90
0 0 0.00 0.00 0.00 0.00
Type the forwarding address into your ipad. For me, http://014da213.ngrok.io
No config required!
192.168.1.6 is an ip address, eg the address of your computer on the local network.
:3000 is a port number (well, 3000 is the number, the ":" just separates it from the ip address), in this case the port which Rails runs on.
localhost.dev is an alias set up on your machine, probably for 127.0.0.1 which is the standard "this computer, ie the 'local host'" ip address.
I wouldn't have expected 192.168.1.2.dev to work at all because it's not a valid ip address - it's an ip address with the last bit of your alias on the end.
You should use "192.168.1.2:3000" on your ipad to connect to your local computer's rails server. You shouldn't need to change your proxy settings (so set them back to normal).
If you specifically want to use a particular domain name on your ipad (when you access your rails app), which can be useful if your app displays the site differently based on the domain or subdomain that it was accessed via, then you can use the awesome http://xip.io/ . This is probably more complicated than you need though, it sounds like you just want to see what your rails app looks like on an ipad.

WAMP Server Forbidden error

I have been running a website I have been developing on WAMPserver.
When ever I try to access it through my IPv4 address on the computer that it is running on and any other device on the network I ge a error 403 Forbidden You don't have permission to access / on this server.
Please help I kind of need it by a due date.
WAMPServer is designed as a development tool and not an environment for a LIVE site, so by default all the Apache security is based around allowing access from the PC running WAMPServer and nothing else.
If you want to open up your site to the world, you can use the menu item Put Online
left click wampmanager -> Put Online
If this does not work, usually becasue you have chnaged something in the httpd.conf file you can make the required changes manually.
Edit \wamp\bin\apache\apachex.y.z\conf\httpd.conf\httpd.conf
Find this section
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
And change it to
# onlineoffline tag - don't remove
Order Allow,Deny
Allow from all
If you are using Apache 2.4.x the syntax has chnaged and you shoudl change it to
# onlineoffline tag - don't remove
Require all granted
BE VERY CAREFULL not to change any other section to Allow from all or Require all granted as this can compromise you PC security very easily.

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