403 Acess forbidden

Problems with the Linux version of XAMPP, questions, comments, and anything related.

403 Acess forbidden

Postby michalzeszen » 06. August 2018 22:15

Hi there, I'm receiving the 403 error while trying to acess my localhost test page, can you find what is wrong with my configurations?

- /opt/lampp/etc/httpd.conf
Code: Select all
# Virtual hosts
Include etc/extra/httpd-vhosts.conf


- /opt/lampp/etc/extra/httpd-vhosts.conf
Code: Select all
    <VirtualHost php.test:80>
        DocumentRoot "/home/Adriano/dev/phpprojects"
        ServerName php.test
    <Directory "/home/Adriano/dev/phpprojects">
        Require all granted
    </Directory>
    </VirtualHost>
     
    <VirtualHost localhost:80>
        DocumentRoot "/opt/lampp/htdocs"
        ServerName localhost
    </VirtualHost>


- ls -l /opt/lampp
Code: Select all
drwxr-xr-x  5 root    root       4096 ago  5 22:01 apache2
drwxrwxr-x  2 root    root      12288 ago  5 22:01 bin
drwxr-xr-x  2 root    root       4096 ago  5 22:02 build
drwxr-xr-x  2 root    root       4096 ago  5 22:01 cgi-bin
-rw-r--r--  1 root    root      86263 jun 15 21:19 COPYING.thirdparty
-rwxr-xr-x  1 root    root      27400 ago  5 22:01 ctlscript.sh
drwxr-xr-x  2 root    root       4096 ago  5 22:02 docs
drwxrwxr-x  3 root    root       4096 ago  5 22:01 error
drwxr-xr-x  8 root    root       4096 ago  5 23:22 etc
drw-r-Sr--  5 adriano adriano    4096 ago  5 22:01 htdocs
drwxr-xr-x  3 root    root       4096 ago  5 22:01 icons
drwxr-xr-x  2 root    root       4096 ago  5 22:01 img
drwxr-xr-x 22 root    root      12288 ago  5 22:02 include
drwxr-xr-x  2 root    root       4096 ago  5 22:02 info
lrwxrwxrwx  1 root    root         16 ago  5 22:02 lampp -> /opt/lampp/xampp
drwxr-xr-x 15 root    root      12288 ago  5 22:03 lib
drwxr-xr-x  2 root    root       4096 ago  5 22:01 libexec
drwxr-xr-x  2 root    root       4096 ago  5 22:01 licenses
drwxr-xr-x  2 daemon  daemon     4096 ago  6 18:03 logs
drwxr-xr-x  7 root    root       4096 ago  5 22:02 man
-rwx------  1 root    root    3361003 fev 27  2017 manager-linux-x64.run
drwxr-xr-x 14 root    root      12288 ago  5 22:02 manual
drwxr-xr-x  2 root    root       4096 ago  5 22:02 modules
drwxr-xr-x  3 root    root       4096 ago  5 22:01 mysql
drwxr-xr-x  2 root    root       4096 ago  5 22:01 pear
drwxr-xr-x  3 root    root       4096 ago  5 22:01 php
drwxr-xr-x 12 root    root       4096 ago  5 22:01 phpmyadmin
drwxr-xr-x  3 root    root       4096 ago  5 22:01 proftpd
-rw-r--r--  1 root    root        904 ago  5 22:03 properties.ini
-rw-r--r--  1 root    root      19510 jun 15 21:19 README-wsrep
-rw-r--r--  1 root    root       2356 jul  6 06:25 RELEASENOTES
drwxr-xr-x  2 root    root       4096 ago  5 22:02 sbin
drwxr-xr-x 50 root    root       4096 ago  5 22:02 share
drwxrwxrwx  2 daemon  daemon     4096 ago  5 22:42 temp
-rwx------  1 root    root    9153097 ago  5 22:03 uninstall
-rw-------  1 root    root     302997 ago  5 22:03 uninstall.dat
drwxr-xr-x  7 root    root       4096 ago  6 18:03 var
-rwxr-xr-x  1 root    root      15201 jul 22  2013 xampp
michalzeszen
 
Posts: 2
Joined: 06. August 2018 22:07
XAMPP version: 7.2.7
Operating System: Ubuntu 18.04

Re: 403 Acess forbidden

Postby Nobbie » 07. August 2018 11:05

Dont you see that you have a "Require all granted" for one DocumentRoot in the VirtualHost, but not for the other one (localhost)? Thats the problem.

Also your VirtualHost Token is wrong, instead of

Code: Select all
<VirtualHost php.test:80>


and insteand of

Code: Select all
<VirtualHost localhost:80>


you should replace both by:

Code: Select all
<VirtualHost *:80>


or, if you only want to listen on 127.0.0.1, replace both by:

Code: Select all
<VirtualHost 127.0.0.1:80>


But usually *:80 is fine. For ALL VirtualHosts. The ServerName inside is assigned to the Name of the VirtualHost (not the Token after VirtualHost).
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: 403 Acess forbidden

Postby michalzeszen » 12. August 2018 22:12

Thanks Nobbie! You proved to be not a noobie at all.

All running smooth now.
michalzeszen
 
Posts: 2
Joined: 06. August 2018 22:07
XAMPP version: 7.2.7
Operating System: Ubuntu 18.04


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 24 guests