简体   繁体   中英

XAMPP access forbidden issues

Having issues with XAMPP and access forbidden problems.

Started using laravel, complete noob to anything MVC but thought I'd give it a go.

Started having issues with page routing, index page works fine, yet non of my routes work, all come up with a 404 error.

Have a little search around the internet, find out it could be due to my xampp/Apache config.

Had a play with the

Allow from all

and

Require all granted

options, but no dice.

This is my vhosts entry:

<VirtualHost *:80>
    DocumentRoot "C:\Users\xxx\Desktop\Projects\xxx\Website-3.0\Website\public"
    ServerName gw3.dev
    <Directory "C:\Users\xxx\Desktop\Projects\xxx\Website-3.0\Website\public">
        Allow from all
        Require all granted
        Options Indexes
    </Directory>
</VirtualHost>

and this is what I edited in the httpd.conf file.

<Directory />
    Require all granted
    Options FollowSymLinks
    AllowOverride All
    Allow from all
</Directory>

Made sure that the root directory is not read only. Yet all I get are 403 - forbidden access errors.

Running Windows 10, fyi.

Not really sure where I'm going wrong here. Is there something I'm missing?

This section

<Directory />
    Require all granted
    Options FollowSymLinks
    AllowOverride All
    Allow from all
</Directory>

Provides the basic security for the disk that Apache is installed on. Basic practice is deny access to everything and then allow access to only those directories that Apache should have access to. Also you are using Pache 2.2. and 2.4 syntax together, bad.

So change that back to :-

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

In the definition of the virtual host you are using both Apache 2.2 and 2.4 syntax. Thats not a good idea it can cause Apache to get confused. Also you are using the DOS back slash and that should be the unix forward slash.

So try this

<VirtualHost *:80>
    DocumentRoot "C:/Users/xxx/Desktop/Projects/xxx/Website-3.0/Website/public"
    ServerName gw3.dev
    <Directory "C:/Users/xxx/Desktop/Projects/xxx/Website-3.0/Website/public">
        AllowOverride All
        Options Indexes FollowSymLinks
        Require all granted
    </Directory>
</VirtualHost>

If you dont actually intend to allow anybody in the universe to access this site then you can use

Require local

Or if you want to access the site from another device in your local network you could try

Require ip 192.168.1

Note use of only 3 of the 4 quartiles of the IPV4 ip address. This allows access from any ip in that subnet.

Also make sure that you have added gw3.dev to your HOSTS file for both IPV4 and IPV6 addresses

127.0.0.1 gw3.dev
::1  gw3.dev

Retart Apache and try that.

You need

 AllowOverride All 

too in vhost

also dont forget to reboot the server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM