AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 118605
Accepted
Paul Tomblin
Paul Tomblin
Asked: 2010-03-03 20:47:30 +0800 CST2010-03-03 20:47:30 +0800 CST 2010-03-03 20:47:30 +0800 CST

为什么 Apache 无法识别我的 VirtualHosts ServerName?

  • 772

我正在尝试在硬件崩溃后从备份中重建服务器。我没有恢复整个映像,而是尝试结合安装软件,然后从备份中恢复配置文件。但是 Apache2 似乎没有遵守我的 /etc/apache2/sites-enabled/* 文件中的“ServerName”指令。/server-info 显示它正在选择正确的配置,但它没有显示我的站点,只是 /var/www/html/index.html 中的默认索引页面。这是 /server-info 的一个片段:

Module Name: core.c
Content handlers: yes

...

Current Configuration:
In file: /etc/apache2/apache2.conf
  57: LockFile /var/lock/apache2/accept.lock
  66: PidFile /var/run/apache2.pid
  71: Timeout 300
 107: MaxRequestsPerChild 0
 136: AccessFileName .htaccess
 156: DefaultType text/plain
 167: HostnameLookups Off
 175: ErrorLog /var/log/apache2/error.log
 182: LogLevel warn
In file: /etc/apache2/mods-enabled/alias.conf
  17: <Directory "/usr/share/apache2/icons">
  18:   Options Indexes MultiViews
  19:   AllowOverride None
    : </Directory>
In file: /etc/apache2/ports.conf
   8: NameVirtualHost *:80
In file: /etc/apache2/conf.d/security
  27: ServerTokens Full
  38: ServerSignature On
  49: TraceEnable On
In file: /etc/apache2/conf.d/servername
   1: ServerName xen1.xcski.com
   2: ServerAdmin [email protected]
   4: ServerSignature EMail
In file: /etc/apache2/sites-enabled/000-default
   1: <VirtualHost *:80>
   2:   ServerAdmin [email protected]
   4:   DocumentRoot /var/www/html
   5:   <Directory />
   6:     Options FollowSymLinks
   7:     AllowOverride None
    :   </Directory>
   9:   <Directory /var/www/html>
  10:     Options Indexes FollowSymLinks MultiViews
  11:     AllowOverride None
    :   </Directory>
  17:   <Directory "/var/www/cgi-bin">
  18:     AllowOverride None
  19:     Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    :   </Directory>
  80:   ErrorLog /var/log/apache2/error.log
  84:   LogLevel warn
  87:   ServerSignature EMail
    : </VirtualHost>
In file: /etc/apache2/sites-enabled/rochesterflyingclub.com
   2: <VirtualHost *>
   3:   ServerName rochesterflyingclub.com
   4:   ServerAlias www.rochesterflyingclub.com
   5:   ServerAdmin [email protected]
   7:   DocumentRoot /www/rochesterflyingclub.com/www
   8:   <Directory />
   9:     Options FollowSymLinks
  10:     AllowOverride None
    :   </Directory>
  12:   <Directory /www/rochesterflyingclub.com/www/>
  13:     Options Indexes FollowSymLinks MultiViews Includes
  15:     AllowOverride FileInfo AuthConfig Limit
    :   </Directory>
  20:   <Directory "/www/rochesterflyingclub.com/cgi-bin/">
  21:     AllowOverride None
  22:     Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
    :   </Directory>
  27:   ErrorLog /var/log/apache2/error.log
  31:   LogLevel warn
  34:   ServerSignature EMail
    : </VirtualHost>
apache-2.2 virtualhost
  • 3 3 个回答
  • 8067 Views

3 个回答

  • Voted
  1. Dave Cheney
    2010-03-04T01:46:36+08:002010-03-04T01:46:36+08:00

    检查输出

    apachectl -S
    

    我认为您缺少一个配置,例如

    Include /etc/apache2/sites-enabled/*
    
    • 7
  2. Best Answer
    Eddy
    2010-03-03T22:28:09+08:002010-03-03T22:28:09+08:00

    要么从第一个中删除 :80,要么对所有元素重复它。我认为最具体的地址定义优先

    • 2
  3. Jakub
    2010-03-03T21:10:07+08:002010-03-03T21:10:07+08:00

    我相信您需要为虚拟主机定义端口:

    <VirtualHost *:80>
     ...
    </VirtualHost>
    

    试一试。否则,我只是在猜测,您是否尝试过查看错误/访问日志以查看文件的来源?Apache2 不难设置。VirtualHost 问题最常见的是拼写错误或损坏的 conf 格式。

    • 1

相关问题

  • 在您分发的应用程序中使用 Apache HTTPD 运行 SSL 的最佳方式是什么?

  • 阿帕奇的替代品

  • 如何强制我的网址始终以 www 开头?

  • 在 Linux Xen VPS 上优化 Apache 和 MySQL

  • mod_rewrite 不转发 GET 参数

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    从 IP 地址解析主机名

    • 8 个回答
  • Marko Smith

    如何按大小对 du -h 输出进行排序

    • 30 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    MikeN 在 Nginx 中,如何在维护子域的同时将所有 http 请求重写为 https? 2009-09-22 06:04:43 +0800 CST
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    0x89 bash中的双方括号和单方括号有什么区别? 2009-08-10 13:11:51 +0800 CST
  • Martin Hope
    Kyle Brandt IPv4 子网如何工作? 2009-08-05 06:05:31 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve