我已经坚持这个问题两天了,现在没有用。我已经在服务器论坛上发布了这个,但我没有得到任何答案所以我会在这里尝试。
我有:
所有在我的机器上运行都很好。我可以去phpMyAdmin和MAMP的主页。我现在正在尝试为位于我的根目录中的本地站点创建虚拟主机:
/用户/ USR /网站
我的/ private / etc / hosts如下所示:
# 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
fe80::1%lo0 localhost
#Local Hosts
127.0.0.1 local.sites
127.0.0.1 local.site1
127.0.0.1 local.site2
127.0.0.1 local.site3
在我的/Applications/MAMP/conf/apache/httpd.conf中我没有注释:
# Virtual hosts
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
我现在已经在该文件中给出了localhosts指令:
#
# Virtual Hosts
#
# 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.2/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.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# 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.
#
#he first five lines of code turn on the Virtual Host feature on Apache, and set up the #Applications:MAMP:htdocs folder as the default location for http://localhost. That’s #important since you need to be able to access the MAMP web pages at http://localhost/ so #that you can use PHPMyAdmin.
NameVirtualHost *
<VirtualHost *>
DocumentRoot "/Applications/MAMP/htdocs"
ServerName localhost
</VirtualHost>
NameVirtualHost *
<VirtualHost *>
DocumentRoot "/Users/usr/Sites/"
ServerName local.sites
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/usr/Sites/site1/“
<Directory /Users/usr/Sites/site1>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ServerName local.site1
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/usr/Sites/site2/“
<Directory /Users/usr/Sites/site2/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ServerName local.site2
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/usr/Sites/site3/“
<Directory /Users/usr/Sites/site3/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ServerName local.site3
</VirtualHost>
浏览 localhost 会给我一个空白索引页面
浏览 local.sites 为我提供了一个有效的 index.php 页面
浏览 local.site1,local.site2,local.site3 给了我可怕的:
内部服务器错误
服务器遇到内部错误或配置错误,无法完成您的请求 请联系服务器管理员you@example.com并告知他们错误发生的时间,以及可能导致错误的任何操作。
服务器错误日志中可能提供了有关此错误的更多信息。
我没有做任何“幻想”。我没有运行Wordpress(尚未)或其他任何东西,但我无法理解为什么我的默认站点根工作但不是它的子目录 / Users / usr / Sites / x 。
有人可以帮助我吗?