2

I installed genymotion emulator on my PC and I want to access my WAMP local server to it and I ran ipconfig on my cmd so I got this IP_address 192.168.56.1 but the problem is that I always get this error

403 Forbidden You don't have permission to access / on this server

I tried all the answers given in this question yet none solved my problem.

I am running Mysql 5.5.8, PHP 5.3.5 and Apache 2.2.17

Please do anyone know how I can fix this error?

@KANAYOAUSTINKANE. This is my code or the Subdomain

<Virtualhost *:80>
    DocumentRoot "C:/wamp/www/mobile"
    ServerName localhost
    ServerAlias m.local host
</Virtualhost>

Please help me out, I have been so disturbed

Community
  • 1
  • 1
  • can you view that url in a browser, outside genymotion? – chiliNUT Aug 17 '16 at 12:25
  • No all browser still gives me the same error. Chrome, Firefox, opera –  Aug 17 '16 at 13:11
  • Are you trying a mobile site? If yes then did you create any virtual host or Subdomain for your mobile site or you still use the `localhost` if you did create a virtual host then I would love to see your httpd-vhost.conf file for the virtual host because I think I have found your answer – KANAYO AUGUSTIN UG Aug 17 '16 at 15:11
  • Yes I did. I will edit my question to show my code –  Aug 17 '16 at 15:19
  • @TheKingis then the problem is the wamp setup and has nothing to do with genymotion – chiliNUT Aug 17 '16 at 16:50

1 Answers1

0

Okay, here is a solution.

First step

Change the location of your virtual host and add a / at the end like this

DocumentRoot "C:/wamp/www/mobile/"

Second step

Go to your httpd.conf file located at C:/camp/bin/apache/Apache2.2.17/conf/httpd.conf the go to the line that has Listen 80 and change it to Listen *:80 this will make it to listen to any IP address

Finally

You go to the end of your httpd.conf file and add this

# Tells Apache to identify which site by name
NameVirtualHost *:80
# Tells Apache to serve the default WAMP Server page to "localhost"
<VirtualHost 127.0.0.1>
    ServerName localhost
    DocumentRoot "C:/wamp/www"
</VirtualHost> 
# Tells Apache to serve your mobile pages to "m.localhost"
<VirtualHost 127.0.0.1>
# The name to respond to ServerName m.localhost
# Folder where the file is located which in your case is
    DocumentRoot "C:/wamp/www/mobile/"
<Directory "C:/wamp/www/mobile/">
    Allow from all
    Order Allow,Deny
    AllowOverride All
</Directory>
# Apache will look for these files, in this order, if no file is specified in the URL, but you can add more files apart from the two I listed depending on what you are having
    DirectoryIndex index.html index.php
</VirtualHost> 
#Here you duplicate the code for your mobile site to also accept your IP address which is 192.168.56.1
<VirtualHost 192.168.56.1>
# The name to respond to ServerName m.localhost
# Folder where the file is located which in your case is
    DocumentRoot "C:/wamp/www/mobile/"
<Directory "C:/wamp/www/mobile/">
    Allow from all
    Order Allow,Deny
    AllowOverride All
</Directory>
# Apache will look for these files, in this order, if no file is specified in the URL, but you can add more files apart from the two I listed depending on what you are having
    DirectoryIndex index.html index.php
</VirtualHost>

Tested and working. Please don't forget to mark the answer

KANAYO AUGUSTIN UG
  • 2,078
  • 3
  • 17
  • 31
  • Thanks very much. Your answer is great and perfect, it solved my problem perfectly. :) –  Aug 17 '16 at 15:52