当前位置: 首页 > 知识库问答 >
问题:

无法访问Apache httpd虚拟主机

彭弘方
2023-03-14

我是Linux的新手,我能够在Manjaro上安装我的LAMP服务器。得到了一切的窍门,但现在有问题设置我的虚拟主机。我正在使用http://httpd.conf.中注释出"包含conf/额外/httpd-vhosts.conf",但在编辑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.
#

NameVirtualHost *:80

<VirtualHost *:80> 
    ServerAdmin dummy@gmail.com 
    DocumentRoot "/srv/http/sami" 
    ServerName dummy.local 
    ErrorLog "/srv/http/sami/dummy-host.example.com-error_log" 
    CustomLog "/srv/http/sami/dummy-host.example.com-access_log" common 
</VirtualHost>

<VirtualHost *:80> 
    ServerAdmin dummy@gmail.com 
    DocumentRoot "/srv/http" 
    ServerName localhost 
    ErrorLog "/srv/http/error-log" 
    CustomLog "/srv/http/access-log" common 
</VirtualHost>

但是dummy.local没有加载并说,

无法访问此站点。找不到本地服务器的IP地址。

谢谢你。

共有1个答案

禹昆
2023-03-14

在对一些基本步骤进行故障排除之后,我通过简单地将虚拟主机的ServerName添加到/etc/hosts中来解决问题

127.0.0.1假人。地方的

这为我解决了问题。希望这对其他人也有帮助。祝您今天过得愉快。

 类似资料:
  • 我正在使用ubuntu 11.10,并在不同的ip上安装了不同的虚拟主机,如 我想在IE9中测试这些网站,为此,我在oracle虚拟框中安装了windows7,还修改了windows7host文件,并在文件末尾添加了此行10.0.2.2 localhost,还创建了一个新的适配网桥 完成所有这些设置后,我可以从windows7访问ubuntu的localhost,但在访问ubuntu的虚拟主机时发

  • 我在本地机器(Mac)上工作,其中有一个名为sqlvm的遗留虚拟机(这意味着我可以通过http://sqlvm:从本地主机访问这个虚拟机)。现在,我在应该连接到vm的同一个本地主机(我的Mac)中设置了几个docker容器(使用docker-compose)。< code>pymysql会引发一个异常: 如何将外部的“sqlvm”公开给内部 Docker 网络? 编辑:我尝试在yml文件中为相关容

  • 两个虚拟主机(纯静态-html 支持) - Two Virtual Hosts, Serving Static Files http { : server { : listen 80; : server_name www.domain1.com; : access_log logs/domain1.access.log main; : location / {

  • 我已经正确设置了与Java相关的环境变量。Java工作得很好。我已经将.jar文件与java SDK关联起来。 从cmd调用javaw-xms128m-xmx512m-jar filename.jar命令时,我得到一个java虚拟机启动程序错误:无法访问jarfile 然后我在jar所在的文件夹上调用了相同的命令,我没有错误,但是程序的gui仍然没有打开。

  • 我正在使用AWS Amplify设置AppSync GraphQL API。我有一个带有@model注释的模式,我正在尝试编写一个lambda解析器,它将读/写@model生成的DynamoDB表。然而,当我尝试使用进行本地测试时,我的JS函数抛出 我似乎根本找不到关于这个用例的太多文档(大多数lambda解析器的示例都是从其他表/api读取的,这些表/api不是放大应用程序的一部分),所以任何指

  • 主要内容:Apache虚拟主机类型,3. 虚拟主机配置示例Apache Web服务器可以在SAME服务器上托管多个网站。每个网站不需要单独的服务器机器和apache软件。这可以使用虚拟主机或VHost的概念来实现。 要在Web服务器上托管的任何域(网站应用)都将在apache配置文件中具有单独的条目。 Apache虚拟主机类型 Apache虚拟主机类型有两种 - 基于名称的虚拟主机 基于地址或基于IP的虚拟主机。 1. 基于名称的虚拟主机 基于名称的虚拟