我已經構式WAMP-Server,以便它會與一些地方領域的工作,如下: http://proloma http://sweporr
WAMP服務器多個域
它的工作原理很好當地使用,但我有2個不同的.com域名指向我的服務器,我怎麼能做到這一點,使互聯網上的人可以通過訪問不同的域訪問不同的頁面?
我的域名是:
www.proloma.com www.sweporr.com
而且他們目前都指向同一個文件夾(c:/ wamp/www)。
我希望他們指出這樣的:
www.proloma.com -> http://proloma www.sweporr.com -> http://sweporr
這是我的httpd-vhosts.conf:
# Virtual Hosts
#
# Required modules: mod_log_config
# 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.4/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.
#
# 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>
ServerAdmin [email protected]
DocumentRoot "C:/wamp/www"
ServerName localhost
ServerAlias www.localhost.com
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "C:/Users/Proloma/Dropbox/ProlomaDotCom/www"
ServerName proloma
<Directory "C:/Users/Proloma/Dropbox/ProlomaDotCom/www">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ServerAlias www.proloma.com
ErrorLog "logs/proloma-error.log"
CustomLog "logs/proloma-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "C:/Users/Proloma/Dropbox/SwePorrDotCom/www"
ServerName sweporr
<Directory "C:/Users/Proloma/Dropbox/SwePorrDotCom/www">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ServerAlias www.sweporr.com
ErrorLog "logs/sweporr-error.log"
CustomLog "logs/sweporr-access.log" common
</VirtualHost>
這是我的主人:
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 proloma
127.0.0.1 sweporr
而且我按照所有這些步驟: https://www.kristengrote.com/blog/articles/how-to-set-up-virtual-hosts-using-wamp