Access forbidden - 403 error - VirtualHost

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

Access forbidden - 403 error - VirtualHost

Postby utqi » 19. May 2023 18:43

Good afternoon,
I am trying to set up virtual hosts as instructed

http://localhost/dashboard/docs/configure-vhosts.html

I later used https://community.apachefriends.org/f/viewtopic.php?f=29&t=82712 to set up, but nothing happens.
I get an error Access denied.
https://shottr.cc/s/OPHo/SCR-20230519-k2r.png

Here is data:

/Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf
Code: Select all
# Virtual Hosts
#
# Required modules: mod_log_config

# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "/Applications/XAMPP/xamppfiles/docs/dummy-host2.example.com"
    ServerName dummy-host2.example.com
    ErrorLog "logs/dummy-host2.example.com-error_log"
    CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>

<VirtualHost *:80>
    ServerName jurgau.local
    DocumentRoot /Users/narzan/web/jurgau
    <Directory /Users/narzan/web/jurgau>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName narzan.net
    DocumentRoot /Users/narzan/web/narzan.net
    <Directory /Users/narzan/web/narzan.net>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>


/etc/hosts/
Code: Select all
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255   broadcasthost
::1   localhost
127.0.0.1   dummy-host2.example.com
127.0.0.1   jurgau.local
127.0.0.1   narzan.net


What am I doing wrong?
utqi
 
Posts: 2
Joined: 19. May 2023 18:28
XAMPP version: 8.2.4
Operating System: 13.3.1 (a) (22E772610a)

Re: Access forbidden - 403 error - VirtualHost

Postby Nobbie » 20. May 2023 11:31

Error 403 means, that Apache cannot access the requested file or path. Probably the DocumentRoot. Your DocumentRoot seems to be your home folder, Apache is running with a different UserId and Group than yours and probably cannot access your files. You have to grant at least read access to the Apache User (or Group) for the DocumentRoot. See httpd.conf and lookup the setting of "User" and "Group", these are the User and Group for the Apache Process.
Nobbie
 
Posts: 12858
Joined: 09. March 2008 13:04

Re: Access forbidden - 403 error - VirtualHost

Postby utqi » 20. May 2023 16:29

Thank you for help!
utqi
 
Posts: 2
Joined: 19. May 2023 18:28
XAMPP version: 8.2.4
Operating System: 13.3.1 (a) (22E772610a)


Return to XAMPP for macOS

Who is online

Users browsing this forum: No registered users and 8 guests