我想使用开源的ELK堆栈。Kibana在免费版本中根本没有安全保障。我的想法是,我使用Apache的基本身份验证将Kibana置于Apache反向代理之后,但不知怎么的,反向代理不起作用。
我只启用了一个站点,其内容如下:
<VirtualHost *:80>
ServerName kibana2.softxs.ch
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://127.0.0.1:5601/ retry=0
ProxyPassReverse / http://127.0.0.1/
</VirtualHost>Kibana正在收听端口5601:
$ netstat -lnp | grep 5601
tcp 0 0 127.0.0.1:5601 0.0.0.0:* LISTEN 16465/nodeApache正在监听端口80:
netstat -lnp | grep 80
tcp6 0 0 :::80 :::* LISTEN 21721/apache2然而,如果我使用的是http://kibana2.softxs.ch,我会得到Apache2 Ubuntu默认页面。我不明白,因为site_enabled中没有其他文件。apache日志中没有错误消息。
apachectl -S说:
VirtualHost configuration:
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl
Mutex watchdog-callback: using_defaults
Mutex ssl-stapling-refresh: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33"/var/www/html“只能来自apache编译时。它不是在任何地方定义的,最好只在未启用的虚拟主机中定义:
/etc/apache2# grep -r '/var/www/html'
sites-available/000-default.conf: DocumentRoot /var/www/html
sites-available/default-ssl.conf: DocumentRoot /var/www/html我只看到other_vhosts_access.log中的简单条目,即使LogLevel debug proxy:trace5被添加到VirtualHost配置中:
zg-3.softxs.ch:80 188.143.71.45 - - [03/May/2019:17:26:31 +0200] "GET / HTTP/1.1" 200 3525 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36"
zg-3.softxs.ch:80 188.143.71.45 - - [03/May/2019:17:26:31 +0200] "GET /icons/ubuntu-logo.png HTTP/1.1" 304 180 "http://kibana2.softxs.ch/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36"发布于 2019-05-03 15:47:46
这个问题很小。在/etc/apache2/apache2.conf中,以下行包括虚拟主机配置:
IncludeOptional sites-enabled/*.conf但是我的虚拟主机配置没有.conf扩展。我加了它,它工作得很好。
https://serverfault.com/questions/965302
复制相似问题