如何使用WAMP在Apache 2.4中添加公共虚拟主机

时间:2016-12-06 17:48:56

标签: php apache virtualhost wampserver

  

我有一台Apache服务器,它在端口8080上处理两个虚拟主机,一个是私有(localhost),另一个是公共(互联网)。私有虚拟主机工作正常,但公共保持将所有公共请求重定向到本地主机,我不确定我做错了什么。请帮忙!以下是httpd-vhost.conf文件:

# Virtual Hosts

<VirtualHost *:8080>
ServerName localhost
DocumentRoot c:/wamp64/www
<Directory  "c:/wamp64/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
</Directory>
</VirtualHost>

<VirtualHost *:8080>
ServerName mydomain.com
DocumentRoot c:/wamp64/www/App
<Directory  "c:/wamp64/www/App/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require all granted
</Directory>
DirectoryIndex index.html index.php
</VirtualHost>
#
  

此外,这是在Windows Server 2012上运行WAMP / Magento并在Azure中托管。非常感谢!

2 个答案:

答案 0 :(得分:0)

请查看有关虚拟主机设置的评论。

#
# 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.
#

Refer this

答案 1 :(得分:0)

我发现虚拟主机配置正确,重定向问题出现在MySQL Magento Db中,指向localhost:8080。我将core_config_dataweb/unsecure/base_url下的web/secure/base_url更改为我的公共域,但它运行正常。我发布了这个答案,以防其他人在这里遇到类似的问题。感谢