How to resolve XAMMP virtual host "Access Forbidden!" error in MAC OS Sierra 10.12.6?

Asked

Viewed 664 times

1

I just installed a version of XAMPP xampp-osx-5.5.38-3-installer.dmg.

Then I followed the instructions to set a virtual host. I activated Include etc/extra/httpd-vhosts.conf and created 127.0.0.1 md-test.com inside /etc/hosts.

So when I write md-test.com I am redirected to md-test.com/dashboard/, as expected. I am redirected to the htdocs xampp directory and loads Dashboard.

In /Applications/XAMPP/htdocs created a folder named md drwxrwxr-x 3 root admin 102 21 Aug 12:02 md, where I have an index.php file (echo "testok";).

For the httpd-vhosts.conf file this is what I did:

<VirtualHost *:80>
       DocumentRoot "/Applications/XAMPP/htdocs/md/"
       ServerName md-test.com
</VirtualHost>

Now when I spin md-test.com/ I am not redirected to md-test.com/dashboard/ or even using the localhost that doesn’t redirect me to localhost/dashboard/. Just shows an error:

Access forbidden!

You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.

If you think this is a server error, please contact the webmaster.

Error 403

md-test.com
Apache/2.4.23 (Unix) OpenSSL/1.0.2j PHP/5.5.38 mod_perl/2.0.8-dev Perl/v5.16.3

I used visual studio to edit the files.

Right now when I delete the changes I’ve made to httpd-vhosts.conf continue with the error. And this happens for any apache access of any url.

I checked the permits for httpd-vhosts.conf and remains the same as before.

-rw-rw-r--  1 root  admin   1489 22 Aug 11:44 httpd-vhosts.conf

Any idea what that mistake is?

UPDATE: I found a possible mistake: When I do the setup of vhosts inside the httpd.conf Include etc/extra/httpd-vhosts.conf. even when using full path (Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf) I still have the error.

1 answer

0

I do not use XAMPP but I suspect it is the non-specification of AllowOverride

following example:

<VirtualHost *:80>
    ServerName meusite.local
    DocumentRoot "F:\Projets\Web\site"
    DirectoryIndex index.php
    <Directory "F:\Projets\Web\site">
        Options Indexes FollowSymLinks
        AllowOverride all
        Require all granted
    </Directory>
</VirtualHost>

I suggest that nay use:

<Directory />
    Options Indexes FollowSymLinks
    AllowOverride all
    Require all granted
</Directory>

Since it allows all access to the entire drive you have installed XAMPP(Apache), if this is the C drive: you are making the life of hackers easier!

  • Hi @teliz, I think the problem is even before the vhost configuration. When I do 'Include etc/extra/httpd-vhosts.conf' in httpd.conf.

  • hum.. there’s something in the apache log ?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.