Apache-2.2

Mac OSX 10.8.4 - Apache - 設置虛擬主機

  • October 14, 2013

我似乎無法讓我的虛擬主機工作:

我有一個 /etc/apache2/users/scottr.conf 設置為:

<Directory "/Users/scottr/Sites/">
      Options Indexes MultiViews FollowSymLinks
      AllowOverride All
      Order allow,deny
      Allow from all
</Directory>

然後我將 /etc/apache2/extra/ 設置為:

<VirtualHost *:80>
   ServerName localhost
   DocumentRoot "/Users/scottr/Sites/"
</VirtualHost>

<VirtualHost *:80>
   ServerName whatever
   DocumentRoot "/Users/scottr/Sites/work/whatever/"
</VirtualHost>

http://localhost works fine, but I can't get http://whatever/ to work at all.

看起來很基本。

我錯過了什麼?

/var/log/apache2/error_log doesn't show any entries if I go to http://whatever/

/etc/apache2/httpd.conf 是預設的:

# User home directories
Include /private/etc/apache2/extra/httpd-userdir.conf

# Real-time info on requests and configuration
#Include /private/etc/apache2/extra/httpd-info.conf

# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf

# Local access to the Apache HTTP Server Manual
Include /private/etc/apache2/extra/httpd-manual.conf

# Distributed authoring and versioning (WebDAV)
#Include /private/etc/apache2/extra/httpd-dav.conf

# Various default settings
#Include /private/etc/apache2/extra/httpd-default.conf

/etc/apache2/extra/httpd-userdir.conf :

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

——斯科特

whatever在 /etc/hosts 中有條目嗎?

例如

127.0.0.1  whatever

引用自:https://serverfault.com/questions/545926