Virtual host does not use ServerName - HELP!

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

Virtual host does not use ServerName - HELP!

Postby kappaluppa » 18. April 2020 12:46

I've spent hours trying to figure this out. ..

trying to get kappatest.local to work. It will only work with localhost:8080/kappatest

This is what I've done:

1. Created a folder in htdocs: /opt/lampp/htdocs/kappatest
with one file: index.php with " test "

2. edited /etc/hosts to include 127.0.0.1 kappatest.local

3. edited /opt/lampp/etc/extra/httpd-vhosts.conf to include
Code: Select all
# localhost
<VirtualHost *:80>
    ServerName localhost
    DocumentRoot /opt/lampp/htdocs
</VirtualHost>
<VirtualHost *:80>
    ServerAdmin webmaster@kappatest.local
    DocumentRoot "/opt/lampp/htdocs/kappatest"
    ServerName kappatest.local
    ServerAlias http://kappatest.local
        <Directory "/opt/lampp/htdocs/kappatest>
        ServerSignature Off
        Options Indexes FollowSymLinks IncludesNoExec
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>
<VirtualHost *:80>
    ServerAdmin webmaster@kappatest.local
    DocumentRoot "/opt/lampp/htdocs/newsite/"
    ServerName newsite.local
    ServerAlias http://newsite.local
        <Directory "/opt/lampp/htdocs/newsite">
        ServerSignature Off
        Options Indexes FollowSymLinks IncludesNoExec
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>


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


Restart Apache. Heck restarted XAMPP

Get
Forbidden
You don't have permission to access this resource.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.


ran /opt/lampp/bin/httpd -S and get:
Code: Select all
VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server localhost (/opt/lampp/etc/extra/httpd-vhosts.conf:25)
         port 80 namevhost localhost (/opt/lampp/etc/extra/httpd-vhosts.conf:25)
         port 80 namevhost kappatest.local (/opt/lampp/etc/extra/httpd-vhosts.conf:29)
                 alias http://kappatest.local
         port 80 namevhost newsite.local (/opt/lampp/etc/extra/httpd-vhosts.conf:41)
                 alias http://newsite.local
ServerRoot: "/opt/lampp"
Main DocumentRoot: "/opt/lampp/htdocs"
Main ErrorLog: "/opt/lampp/logs/error_log"
Mutex authdigest-opaque: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex rewrite-map: using_defaults
Mutex authdigest-client: using_defaults
Mutex ssl-stapling: using_defaults
Mutex ldap-cache: using_defaults
Mutex proxy: using_defaults
Mutex authn-socache: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/opt/lampp/logs/" mechanism=default
Mutex mpm-accept: using_defaults
PidFile: "/opt/lampp/logs/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
Define: MODPERL2
User: name="daemon" id=1
Group: name="daemon" id=1



I can't for the life of me figure out what I'm missing.

BTW, the folder named 'dashboard' is also in htdocs and also works with localhost:8080/dashboard

Any help would be appreciated!!
kappaluppa
 
Posts: 1
Joined: 27. October 2014 18:16
Operating System: Windows8

Re: Virtual host does not use ServerName - HELP!

Postby Altrea » 18. April 2020 13:22

Your VirtualHosts are matching for port 80 only, but you used 8080 for your VirtualHosts. The only reason the first virtual host seems to work is because the first one also matching any unmatched requests and the access rule allowing to process the files of the xampp default files is defined in the main configuration file.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11952
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64


Return to XAMPP for macOS

Who is online

Users browsing this forum: No registered users and 19 guests