I'm trying to set up a virtual host using mamp. When i enter http://resihop:8888 I end up in 127.0.0.1. Why?
Some facts:
Sitename: resihop
Apache port: 8888
Host database:
##
# 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
from 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 doe开发者_JAVA技巧sn'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>
You didn't specify NameVirtualHost *:8888 and put your VirtualHost on that port.
NameVirtualHost *:8888
<VirtualHost *:8888>
DocumentRoot "/Users/kristoffernolgren/Documents/Minadokument/hemsidor/resihop"
ServerName resihop
</VirtualHost>
Then check your setup:
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
精彩评论