找不到Apache 2.2虚拟主机URL

找不到Apache 2.2虚拟主机URL,apache,apache2,virtualhost,vhosts,virtual-hosts,Apache,Apache2,Virtualhost,Vhosts,Virtual Hosts,我希望你能帮忙。我有一个现有的Apache2.2服务器,为我维护的网站提供服务。我正在尝试为同事添加其他网站。完成此操作后,当我尝试访问URL时,我得到以下信息: 找不到此服务器上找不到请求的URL/ 下面是我的httpd-vhosts.conf文件的摘要。我有三台新的、大致相同的主机无法工作。只有NDV和默认值在工作 NameVirtualHost *:80 <VirtualHost anycast.ns.cs.boeing.com:80> ServerName

我希望你能帮忙。我有一个现有的Apache2.2服务器,为我维护的网站提供服务。我正在尝试为同事添加其他网站。完成此操作后,当我尝试访问URL时,我得到以下信息:

找不到此服务器上找不到请求的URL/

下面是我的httpd-vhosts.conf文件的摘要。我有三台新的、大致相同的主机无法工作。只有NDV和默认值在工作

NameVirtualHost *:80

<VirtualHost anycast.ns.cs.boeing.com:80>
        ServerName anycast.ns.cs.boeing.com
        ServerAdmin aodhan.hoffman@boeing.com
        DocumentRoot "/opt/www/anycast"

        ScriptAlias /cgi-bin "/opt/www/anycast/cgi-bin/"
        ErrorLog "logs/grant_error_log"
        CustomLog "logs/grant_access_log" common
</VirtualHost>

<VirtualHost *:80>
        ServerAdmin aodhan.hoffman@boeing.com
        DocumentRoot "/opt/httpd/manual"
        ServerAlias ntpm-application-01.ns.cs.boeing.com
        ErrorLog "logs/error_log"
        CustomLog "logs/access_log" common
</VirtualHost>


<VirtualHost *:80>
        ServerAdmin aodhan.hoffman@boeing.com
        DocumentRoot "/opt/www/ndv/html"
        ServerName ndv.web.boeing.com
        ScriptAlias /cgi-bin/ "/opt/www/ndv/cgi-bin/"
        ErrorLog "logs/error_log"
        CustomLog "logs/access_log" common
</VirtualHost>

<Directory "/opt/www/ndv/html/" >
        Options Indexes FollowSymLinks Includes 
        AddType text/html .shtml
        AddOutputFilter INCLUDES .shtml 
        Order allow,deny
        Allow from all
</Directory>

<Directory "/opt/www/anycast/html/" >
        Options Indexes FollowSymLinks Includes 
        Order allow,deny
        Allow from all
</Directory>

您似乎混合了配置方法:

NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.domain.tld
ServerAlias domain.tld *.domain.tld
DocumentRoot /www/domain
</VirtualHost>

<VirtualHost *:80>
ServerName www.otherdomain.tld
DocumentRoot /www/otherdomain
</VirtualHost>
NameVirtualHost*:80
服务器名www.domain.tld
ServerAlias domain.tld*.domain.tld
DocumentRoot/www/domain
服务器名www.otherdomain.tld
DocumentRoot/www/otherdomain
这是Apache文档中关于基于名称的vhost的示例

我可以在没有*->anycast.ns.cs.boeing.com的情况下查看您的配置虚拟主机:80

以及没有服务器名称的vhost,如ServerAlias ntpm-application-01.ns.cs.boeing.com 它有一个别名,但没有名字

我将开始平衡示例中的配置,然后尝试apache是否对此更满意

简而言之:确保每个条目都有*:80和服务器名称

编辑:此配置未经测试,但可能适用于您

NameVirtualHost *:80

<VirtualHost *:80>
        ServerName anycast.ns.cs.boeing.com

        ServerAdmin aodhan.hoffman@boeing.com
        DocumentRoot "/opt/www/anycast/html"

        ScriptAlias /cgi-bin "/opt/www/anycast/cgi-bin/"
        ErrorLog "logs/grant_error_log"
        CustomLog "logs/grant_access_log" common

        <Directory "/opt/www/anycast/html/" >
            Options Indexes FollowSymLinks Includes 
            Order allow,deny
            Allow from all
        </Directory>        
</VirtualHost>

<VirtualHost *:80>
        ServerName ntpm-application-01.ns.cs.boeing.com

        ServerAdmin aodhan.hoffman@boeing.com
        DocumentRoot "/opt/httpd/manual"

        ErrorLog "logs/error_log"
        CustomLog "logs/access_log" common
</VirtualHost>


<VirtualHost *:80>
        ServerName ndv.web.boeing.com

        ServerAdmin aodhan.hoffman@boeing.com
        DocumentRoot "/opt/www/ndv/html"

        ScriptAlias /cgi-bin/ "/opt/www/ndv/cgi-bin/"
        ErrorLog "logs/error_log"
        CustomLog "logs/access_log" common

        <Directory "/opt/www/ndv/html/" >
            Options Indexes FollowSymLinks Includes 
            AddType text/html .shtml
            AddOutputFilter INCLUDES .shtml 
            Order allow,deny
            Allow from all
        </Directory>
</VirtualHost>
NameVirtualHost*:80
ServerName anycast.ns.cs.boeing.com
奥丹。hoffman@boeing.com
DocumentRoot“/opt/www/anycast/html”
ScriptAlias/cgi-bin”/opt/www/anycast/cgi-bin/“
错误日志“日志/授权错误日志”
自定义日志“日志/授权访问日志”通用
选项索引和以下符号链接包括
命令允许,拒绝
通融
ServerName ntpm-application-01.ns.cs.boeing.com
奥丹。hoffman@boeing.com
DocumentRoot“/opt/httpd/manual”
错误日志“日志/错误日志”
自定义日志“日志/访问日志”通用
ServerName ndv.web.boeing.com
奥丹。hoffman@boeing.com
DocumentRoot“/opt/www/ndv/html”
ScriptAlias/cgi-bin/“/opt/www/ndv/cgi-bin/”
错误日志“日志/错误日志”
自定义日志“日志/访问日志”通用
选项索引和以下符号链接包括
AddType text/html.shtml
AddOutputFilter包括.shtml
命令允许,拒绝
通融

我的建议是打开并读取apache生成的所有日志。这会给你一个问题所在的线索。我在mac电脑中阅读了
“/private/var/log/apache2/error\u log”
上的日志,发现了我的线索:
DocumentRoot[/path/to/rootdir]不存在。


我打开vhost文件,发现没有用双引号封装根目录,而是使用了其他类似双引号的字符。我用真正的双引号替换了它们,重新启动apache,然后错误就消失了。

谢谢,我已经平衡了配置,现在看起来是这样,但行为没有什么不同。ndv仍然有效,但anycast只返回“未找到URL”。因为我在上有索引,所以我希望看到一个自动索引,但它只是说“/”找不到。这很奇怪。谢谢,但行为没有什么不同。NameVirtualHost*:80 ServerName anycast.domain.com ServerAdmin aodhan。hoffman@domain.comDocumentRoot“/opt/www/anycast”ScriptAlias/cgi-bin“/opt/www/anycast/cgi-bin/“ErrorLog”logs/grant\u error\u log“CustomLog”logs/grant\u access\u log”常见的选项索引如下SYMLINKS包括订单允许、拒绝所有Uhm的允许,我注意到了这一点。引号在apache配置中真的有效吗?我从来没有见过。我想引号是可以的,因为您的配置对于Web服务器来说似乎是可以的。我附加了一个重新格式化的,可能对你有用。请注意,您的文档根和directoy指令指向不同的目录。和./html,我建议您将目录条目合并到vhost中。还有一个额外的词:除非这是纯粹的intranet:order-allow,deny->allow-from-all可能是一件非常不安全的事情。
NameVirtualHost *:80

<VirtualHost *:80>
        ServerName anycast.ns.cs.boeing.com

        ServerAdmin aodhan.hoffman@boeing.com
        DocumentRoot "/opt/www/anycast/html"

        ScriptAlias /cgi-bin "/opt/www/anycast/cgi-bin/"
        ErrorLog "logs/grant_error_log"
        CustomLog "logs/grant_access_log" common

        <Directory "/opt/www/anycast/html/" >
            Options Indexes FollowSymLinks Includes 
            Order allow,deny
            Allow from all
        </Directory>        
</VirtualHost>

<VirtualHost *:80>
        ServerName ntpm-application-01.ns.cs.boeing.com

        ServerAdmin aodhan.hoffman@boeing.com
        DocumentRoot "/opt/httpd/manual"

        ErrorLog "logs/error_log"
        CustomLog "logs/access_log" common
</VirtualHost>


<VirtualHost *:80>
        ServerName ndv.web.boeing.com

        ServerAdmin aodhan.hoffman@boeing.com
        DocumentRoot "/opt/www/ndv/html"

        ScriptAlias /cgi-bin/ "/opt/www/ndv/cgi-bin/"
        ErrorLog "logs/error_log"
        CustomLog "logs/access_log" common

        <Directory "/opt/www/ndv/html/" >
            Options Indexes FollowSymLinks Includes 
            AddType text/html .shtml
            AddOutputFilter INCLUDES .shtml 
            Order allow,deny
            Allow from all
        </Directory>
</VirtualHost>