you don't have permission to access [custom alias] on this server

后端 未结 6 1226
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-14 15:00

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

相关标签:
6条回答
  • 2021-02-14 15:38

    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

    0 讨论(0)
  • 2021-02-14 15:42

    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...

    0 讨论(0)
  • 2021-02-14 15:45

    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.

    0 讨论(0)
  • 2021-02-14 15:50

    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.

    0 讨论(0)
  • 2021-02-14 15:55

    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

    0 讨论(0)
  • 2021-02-14 16:02

    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.

    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

    0 讨论(0)
提交回复
热议问题