Mamp + виртуальный хост?Почему я просто получаю к корню документа localhost / mamp - PullRequest
3 голосов
/ 28 ноября 2010

Я пытаюсь настроить виртуальный хост, используя mamp. Когда я вхожу http://resihop:8888, я в конечном итоге в 127.0.0.1. Почему?

Некоторые факты:

Sitename: resihop

Порт Apache: 8888

База данных хоста:

##
# 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
127.0.0.1   activate.adobe.com
127.0.0.1   practivate.adobe.com
127.0.0.1   ereg.adobe.com
127.0.0.1   activate.wip3.adobe.com
127.0.0.1   wip3.adobe.com
127.0.0.1   3dns-3.adobe.com
127.0.0.1   3dns-2.adobe.com
127.0.0.1   adobe-dns.adobe.com
127.0.0.1   adobe-dns-2.adobe.com
127.0.0.1   adobe-dns-3.adobe.com
127.0.0.1   ereg.wip3.adobe.com
127.0.0.1   activate-sea.adobe.com
127.0.0.1   wwis-dubc1-vip60.adobe.com
127.0.0.1   activate-sjc0.adobe.com
127.0.0.1   hl2rcv.adobe.com
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0 localhost
127.0.0.1     resihop

от httpd.conf

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

HTTPD-vhosts.conf

#
# 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 *:8888

#
# 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>
   DocumentRoot "/Library/WebServer/Documents"
   ServerName localhost
</VirtualHost>

<VirtualHost *:8888>
   DocumentRoot "/Users/kristoffernolgren/Documents/Minadokument/hemsidor/resihop"
   ServerName resihop
</VirtualHost>

1 Ответ

5 голосов
/ 28 ноября 2010

Вы не указали NameVirtualHost *: 8888 и поместили свой VirtualHost на этот порт.


NameVirtualHost *:8888

<VirtualHost *:8888>
   DocumentRoot "/Users/kristoffernolgren/Documents/Minadokument/hemsidor/resihop"
   ServerName resihop
</VirtualHost>

Затем проверьте настройки:


root@intrepid:~# apache2 -t -S
apache2: bad user name ${APACHE_RUN_USER}
root@intrepid:~# APACHE_RUN_USER=www-data APACHE_RUN_GROUP=www-data apache2 -t -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server localhost (/etc/apache2/sites-enabled/000-default:1)
         port 80 namevhost localhost (/etc/apache2/sites-enabled/000-default:1)
         port 80 namevhost unternet.local (/etc/apache2/sites-enabled/01-unternet:1)
Syntax OK
...