1

我正在寻找一种在 MacOs Monterey 的本地 Apache 服务器上使用多个 DocumentRoots 的方法。localhost 运行良好,但对于其他位置,我有一个错误“禁止您无权访问此资源”。

我尝试使用 VirtualHost 但它不起作用


httpd.conf

ServerName localhost:80

#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other 
# <Directory> blocks below.
#
<Directory />
    AllowOverride none
    Require all denied
</Directory>

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">
    Options FollowSymLinks Multiviews
    MultiviewsMatch Any
    AllowOverride All
    Require all granted
</Directory>

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>


<Directory "/Library/WebServer/CGI-Executables">
    AllowOverride None
    Options None
    Require all granted
</Directory>


Include /private/etc/apache2/other/*.conf


额外/httpd-vhosts.conf

# Virtual Hosts

Listen 80

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot "/Library/WebServer/Documents"
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin example@example.com
    DocumentRoot "/Users/TooikLeChevalier/Documents/IUT/S3/Prog-Web-Serveur"
    ServerName iut.local
#    ServerAlias iut
    ErrorLog "/Users/TooikLeChevalier/Documents/IUT/S3/Prog-Web-Serveur/crash_log/Error"
    CustomLog "/Users/TooikLeChevalier/Documents/IUT/S3/Prog-Web-Serveur/crash_log/Custom" common
    <Directory "/Users/TooikLeChevalier/Documents/IUT/S3/Prog-Web-Serveur">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin example@example.com
    DocumentRoot "/Users/TooikLeChevalier/Documents/Perso/EclypseGames/Local_Dev"
    ServerName eclypsegames.local
    ErrorLog "/Users/TooikLeChevalier/Documents/Perso/EclypseGames/Local_Dev/crash_log/Error"
    CustomLog "/Users/TooikLeChevalier/Documents/Perso/EclypseGames/Local_Dev/crash_log/Custom" common
    <Directory "/Users/TooikLeChevalier/Documents/Perso/EclypseGames/Local_Dev"> 
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>


../主机

##
# 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       iut.local
127.0.0.1       eclypsegames.local

我已随函附上所有可能有助于解决我的问题的文件。

在此先感谢您的帮助

4

0 回答 0