Apache Web Server虚拟主机无法正常工作

时间:2016-07-05 05:07:02

标签: apache logging web server virtualhost

我正在尝试在ui上查看Apache Web服务器上的日志目录。

所以我试图在httpd-vhosts.conf文件中建立一个新的虚拟主机,并尝试将文档根目录提供给logs文件夹。

<VirtualHost *:8083>
    ServerAdmin tecmint@example.com
    DocumentRoot C:/Program Files/Apache Software Foundation/Apache2.2/logs
    ServerName localhost
    ErrorLog logs/example.com-error_log
    CustomLog logs/example.com-access_log common
</VirtualHost> 

我也给了NameVirtualHost *:8083,在httpd.conf中我有了Listen 8083。 当我点击localhost:8083重新启动服务器后,它会给出404。

请你帮我解决一下。

由于

2 个答案:

答案 0 :(得分:0)

确保您已为docroot添加了目录块,并且您至少具有读取权限。

<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/logs/"> 
Require all granted
Options +Indexes
</Directory>

答案 1 :(得分:0)

尝试使用以下VirtualHost配置:

<VirtualHost *:8083>
    ServerAdmin tecmint@example.com
    DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/logs/"
    ServerName localhost:8083
    <Directory />
        Require all granted
        Options +Indexes
    </Directory>
    ErrorLog logs/example.com-error_log
    CustomLog logs/example.com-access_log common
</VirtualHost>