栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

【填坑】解决docker安装ocsinventory遇到的500错误

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

【填坑】解决docker安装ocsinventory遇到的500错误

docker安装ocsinventory遇到500错误
    • docker安装OCS的方法
    • 掉坑
    • 填坑
    • 其他发现

docker安装OCS的方法

在官网文档的正确指导下,我顺利完成了OCS 容器的启动。

有用的内容详见下方:

docker run
-p [HOST_HTTP_PORT]:80
-p [HOST_HTTPS_PORT]:443
–name [PUT_A_NAME_HERE]
-e OCS_DB_NAME=[DB_NAME]
-e OCS_DB_SERVER=[DB_HOST]
-e OCS_DB_PORT=[DB_PORT]
-e OCS_DB_USER=[DB_USER]
-e OCS_DB_PASS=[DB_PASS]
-itd
ocsinventory/ocsinventory-docker-image

掉坑

容器是启动成功了,但是在输入地址访问系统的时候,出现了HTTP ERROR 500的错误提示。
使用docker logs 容器名称查看容器启动信息,发现以下警告和错误信息:

[Wed May 11 05:58:10 2022] OCSINVENTORY: (SOAP): Cannot find XML::Entities
ocsinventory-server: Can't load SOAP::Transport::HTTP* - Web service will be unavailable
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.4. Set the 'ServerName' directive globally to suppress this message
[Wed May 11 05:58:10 2022] OCSINVENTORY: (SOAP): Cannot find XML::Entities
ocsinventory-server: Can't load SOAP::Transport::HTTP* - Web service will be unavailable
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.4. Set the 'ServerName' directive globally to suppress this message
[Wed May 11 05:58:11.284405 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.41 (Ubuntu) mod_perl/2.0.11 Perl/v5.30.0 configured -- resuming normal operations
[Wed May 11 05:58:11.284498 2022] [core:notice] [pid 1] AH00094: Command line: '/usr/sbin/apache2 -D FOREGROUND'
172.17.0.1 - - [11/May/2022:05:59:16 +0200] "GET / HTTP/1.1" 200 3477 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"
172.17.0.1 - - [11/May/2022:05:59:17 +0200] "GET /icons/ubuntu-logo.png HTTP/1.1" 200 3623 "http://192.168.10.167:2080/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"
172.17.0.1 - - [11/May/2022:05:59:17 +0200] "GET /favicon.ico HTTP/1.1" 404 494 "http://192.168.10.167:2080/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"
172.17.0.1 - - [11/May/2022:08:30:01 +0200] "GET /ocsreport HTTP/1.1" 404 495 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"
172.17.0.1 - - [11/May/2022:08:31:20 +0200] "GET /ocsreports HTTP/1.1" 301 603 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"
[Wed May 11 08:31:20.610648 2022] [php7:warn] [pid 114] [client 172.17.0.1:56786] PHP Warning:  mysqli_fetch_object() expects parameter 1 to be mysqli_result, bool given in /usr/share/ocsinventory-reports/ocsreports/require/function_commun.php on line 38
[Wed May 11 08:31:20.611152 2022] [php7:warn] [pid 114] [client 172.17.0.1:56786] PHP Warning:  mysqli_fetch_object() expects parameter 1 to be mysqli_result, bool given in /usr/share/ocsinventory-reports/ocsreports/require/function_commun.php on line 38
[Wed May 11 08:31:20.611733 2022] [php7:warn] [pid 114] [client 172.17.0.1:56786] PHP Warning:  mysqli_fetch_object() expects parameter 1 to be mysqli_result, bool given in /usr/share/ocsinventory-reports/ocsreports/require/function_commun.php on line 38
[Wed May 11 08:31:20.611845 2022] [php7:warn] [pid 114] [client 172.17.0.1:56786] PHP Warning:  require(install.php): failed to open stream: No such file or directory in /usr/share/ocsinventory-reports/ocsreports/require/header.php on line 168
[Wed May 11 08:31:20.611891 2022] [php7:error] [pid 114] [client 172.17.0.1:56786] PHP Fatal error:  require(): Failed opening required 'install.php' (include_path='.:/usr/share/php') in /usr/share/ocsinventory-reports/ocsreports/require/header.php on line 168
填坑

既然有坑,那就得填啊。于是百度、bing(谷歌要翻墙没去)一顿操作猛如虎,翻查了至少百来个网页。最后还是在基友云集的GitHub找到了答案:速来围观。
于是,开始了填坑:

docker exec -it ocs /bin/bash
cd /usr/share/ocsinventory-reports/ocsreports/
wget https://raw.githubusercontent.com/OCSInventory-NG/OCSInventory-ocsreports/master/install.php

然后在浏览器打开http://访问地址/ocsreports/,终于见到了期待已久的安装引导界面。
完成安装操作后,别忘了回到容器里面删掉install.php:

rm -rf install.php

否则,系统会在页面上一直显示安全警告。

其他发现

有遇到其它坑的朋友,可以参考以下文章,说不定可以解决:
ocs问题集结
OCSNG的安装(Windows)
OCSNG资产管理系统安装配置 | ocs inventory | 出错汇总

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/885470.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号