【问题标题】:Virtualhost on macos mamp ERR_CONNECTION_REFUSEDmacos mamp 上的虚拟主机 ERR_CONNECTION_REFUSED
【发布时间】:2021-02-26 20:25:13
【问题描述】:

我在 MacOS Big Sur 下有一台装有 MAMP 的 Mac(当我有 Catalina 时,问题也存在)

我想创建一个虚拟主机

这是我所做的:

  • 在 Application/MAMP/conf/apache/httpd.conf 中,我取消了该行的注释 Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
  • 在我添加的 /private/etc/hosts 中
127.0.0.1 test.deva
127.0.0.1 test.localhost
  • 这是我的 Application/MAMP/conf/apache/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 *

#
# 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 *:8888>
 DocumentRoot /Aplications/MAMP/htdocs
 ServerName localhost
</VirtualHost>
<VirtualHost *:8888>
         DocumentRoot "/Applications/MAMP/htdocs/testhost"
         ServerName test.deva
         ServerAlias www.test.deva
</VirtualHost>

在我检查的MAMP的参数中,我有8888端口

在 htdocs/testhost 我只有一个 index.html 文件

我尝试了很多我在这里看到的问题相同的帖子 但是我仍然有一个 ERR_CONNECTION_REFUSED 错误

请问怎么做?

【问题讨论】:

    标签: apache mamp virtualhost


    【解决方案1】:

    我在 macOS Big Sur 上使用 Docker 设置进行本地 Web 开发时遇到了同样的问题。
    原来问题出在80端口。

    更改配置以侦听 端口 8080 解决了我的问题。

    【讨论】:

    • 谢谢它正在工作,但我无法访问 test.deva 但 test.deva:8080 没问题,如何更改?
    猜你喜欢
    • 1970-01-01
    • 2019-03-01
    • 2017-07-05
    • 2016-07-02
    • 2012-12-26
    • 2015-05-07
    • 2014-08-06
    • 2013-02-17
    • 2017-09-04
    相关资源
    最近更新 更多