10

can anyone help with a following issue: I am using wamp to run projects in my chrome browser. after adding a newAlias which points to my project directory c:/dev/myProject I am getting Forbidden message: you don't have permission to access /newAlias on this server. I can access default Aliases such as phpmyadmin, webgrind... but i cannot access my own. I am using WampServer Version 2.5 64bit on Win 8.1 64bit located in c:/wamp. I tried basic stuff from the net but with no luck. Any suggestions?

Edit: content of newAlias:

Alias /bs1/ "c:/_DEV_/git/NewProject/www/" 

<Directory "c:/_DEV_/git/NewProject/www/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order allow,deny
    Allow from all
</Directory>
John Saunders
  • 160,644
  • 26
  • 247
  • 397
fasola81
  • 287
  • 1
  • 3
  • 13

6 Answers6

15

Dont change that section of your httpd.conf. Those few lines control access to the root folder of the drive that Apache is installed on. So you just gave full access to anybody with a handy hack.

The process of securing the access via Apache is to deny all access to everything from the root folder and below, and then selectively allow access for specific sites to specific areas/folders of the drive.

A better solution would be to change httpd.conf back to how it was and make the change in your Alias definition. Like this :-

Alias /bs1 "c:/_DEV_/git/NewProject/www/" 

<Directory "c:/_DEV_/git/NewProject/www/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Require local         <-- to develop on this PC
    Require ip 192.168.1  <-- to access the server from another PC on your network
    Require all granted   <-- to allow the world to see the beauty of your site
</Directory>

It is actually a better idea to use Virtual Hosts to control each site and not Alias's.

Here is a why and Howto :- WAMPServer 2.5 The Homepage, Your Projects Menu and the need for Virtual Hosts

Community
  • 1
  • 1
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
12

I've updated WAMP from 2.2.22 to 2.4.9 and found that new aliases didn't work (same error message as yours).

Checking the default aliases like phpmyadmin, I've found this:

Alias /phpmyadmin "c:/wamp/apps/phpmyadmin4.1.14/"

# to give access to phpmyadmin from outside 
# replace the lines
#
# Require local
#
# by
#
# Require all granted
#

<Directory "c:/wamp/apps/phpmyadmin4.1.14/">
   Options Indexes FollowSymLinks MultiViews
   AllowOverride all
  <IfDefine APACHE24>
    Require local
  </IfDefine>
  <IfDefine !APACHE24>
    Order Deny,Allow
      Deny from all
      Allow from localhost ::1 127.0.0.1
    </IfDefine>
  php_admin_value upload_max_filesize 128M
  php_admin_value post_max_size 128M
  php_admin_value max_execution_time 360
  php_admin_value max_input_time 360
</Directory>

If you see the contents of the file you'll notice the <IfDefine APACHE24> and <IfDefine !APACHE24> conditionals. So I've changed my alias .conf file from:

Alias /svn "c:/work/website-svn/" 

<Directory "c:/work/website-svn/">
    Options Indexes FollowSymLinks MultiViews

    AllowOverride all
    Order allow,deny
    Allow from all

</Directory>

to:

Alias /svn "c:/work/website-svn/" 

<Directory "c:/work/website-svn/">
    Options Indexes FollowSymLinks MultiViews

    Require local

</Directory>

That solved my problem, I hope it solves yours.

Gonzalingui
  • 1,357
  • 14
  • 18
  • 3
    This answer should be accepted. WAMP 2.5 comes with Apache 2.4, which uses `Require` for access control. Apache 2.2 used the `Order, Deny, Allow, Satisfy` directives. See here for upgrading from Apache 2.2 to 2.4: http://httpd.apache.org/docs/2.4/upgrading.html. – Jack Jun 16 '15 at 00:22
  • Shouldn't WAMP take that change into account when it adds an alias? By deafult it uses the old syntax. – konrad Oct 13 '15 at 07:05
1

I am no expert on this but the answer above seemed like I was granting access to my entire computer...So tried modifying the above answer to only giving access to where my alias folder is...

So instead...Go to the httpd.conf file...and do a search for...

<Directory />
   AllowOverride none
   Require all denied
</Directory>

and below that add the following

<Directory "c:/path-to-your-alias-folder...">
   AllowOverride none
   Require all granted
</Directory>

This worked to me and I think it might be a bit safer...Again I am no expert here...Just trying to make it work...

1

for allow permission for your server & wamp you require 3 steps please ensure these 3 things after that you can access your site from other network with ip address e.g http://192.168.1.1/yoursitefoldername (192.168.1.1 is you computer or vps ip address "yoursitefoldername" is folder name of your site which should be in your wamp->www folder)

1.

first of all Port 80 and 443 must be allow for both TCP and UDP packets. To do this, create 2 inbound rules for TPC and UDP on Windows Firewall for port 80 and 443. (or you can disable your whole firewall for testing but permanent solution if allow inbound rule)

2.

If you are using WAMPServer 3 See bottom of answer

For WAMPServer versions <= 2.5

You need to change the security setting on Apache to allow access from anywhere else, so edit your httpd.conf file.

Change this section from :

#   onlineoffline tag - don't remove
     Order Deny,Allow
     Deny from all
     Allow from 127.0.0.1
     Allow from ::1
     Allow from localhost

To :

#   onlineoffline tag - don't remove
    Order Allow,Deny
      Allow from all

if "Allow from all" line not work for your then use "Require all granted" then it will work for you.

WAMPServer 3 has a different method

In version 3 and > of WAMPServer there is a Virtual Hosts pre defined for localhost so dont amend the httpd.conf file at all, leave it as you found it.

Using the menus, edit the httpd-vhosts.conf file.

enter image description here

It should look like this :

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot D:/wamp/www
    <Directory  "D:/wamp/www/">
        Options +Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

Amend it to

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot D:/wamp/www
    <Directory  "D:/wamp/www/">
        Options +Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

Hopefully you will have created a Virtual Host for your project and not be using the wamp\www folder for your site. In that case leave the localhost definition alone and make the change only to your Virtual Host.

3. Dont forget to restart All Services of Wamp or Apache after making this change

Community
  • 1
  • 1
Hassan Saeed
  • 6,326
  • 1
  • 39
  • 37
0

I found a solution which worked for me. In httpd.conf i changed:

<Directory />
    AllowOverride none
    Require all denied
</Directory>

to

<Directory />
    AllowOverride none
    Require all granted
</Directory>

Which solved the issue and allowed me to access my custom aliases.

fasola81
  • 287
  • 1
  • 3
  • 13
0

I would suggest that you consider setting up virtual hosts instead. It takes a few more minutes, but it's more bulletproof. RiggsFolly's answer to a similar question is excellent in its detail, rigor, and utility:

Project Links do not work on Wamp Server

irthinker
  • 13
  • 6