简体   繁体   English

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

[英]How to add public virtual host in Apache 2.4 with WAMP

I have an Apache server that handles two virtual host on port 8080, one is private (localhost) and a second one is public (internet). 我有一个Apache服务器,该服务器可以在端口8080上处理两个虚拟主机,一个是私有(localhost),第二个是公共(internet)。 The private virtual host works fine but the public keeps redirecting all public requests to the localhost and I'm not sure what I'm doing wrong. 私有虚拟主机工作正常,但是公共不断将所有公共请求重定向到本地主机,我不确定自己在做什么错。 Please help! 请帮忙! Below is the httpd-vhost.conf file: 以下是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>
#

Also, this is running WAMP / Magento on Windows Server 2012 and hosted in Azure. 另外,它在Windows Server 2012上运行WAMP / Magento,并托管在Azure中。 Thanks a lot! 非常感谢!

Please find the comments on virtual host settings. 请找到有关虚拟主机设置的注释。

#
# 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 推荐这个

I found that the virtual host was configured correctly and the re-directing problem was in MySQL Magento Db, which was pointing to the localhost:8080 . 我发现虚拟主机配置正确,重定向问题出在MySQL Magento Db中,它指向localhost:8080 I changed core_config_data under web/unsecure/base_url and web/secure/base_url to my public domain and it worked fine. 我将web/unsecure/base_urlweb/secure/base_url下的core_config_data更改为我的公共域,并且工作正常。 I posted this answer in case someone else lands here with a similar problem. 我张贴了这个答案,以防其他人遇到类似问题。 Thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM