MythWeb

出自 ArchWiki

MythWeb 是一个用于 MythTV 的 Web 界面

安装

在安装 MythWeb 之前,首先按照 Apache HTTP ServerApache HTTP Server#PHP 中的描述设置 Apache 和 PHP。

安装 mythplugins-mythwebAUR 软件包。

配置

MythTV 集成

MythWeb 在 video_dir 目录中查找 MythTV 录制文件。创建指向 MythTV 录制文件存储目录的链接

# ln -s recording_dir /var/lib/mythtv/mythweb/video_dir

MythWeb

将 MythWeb 配置文件 mythweb.conf 复制到 Apache HTTP Server 配置目录。

# cp /var/lib/mythtv/mythweb/mythweb.conf.apache /etc/httpd/conf/extra/mythweb.conf

并在 /etc/httpd/conf/httpd.conf 文件的底部包含它

Include conf/extra/mythweb.conf

如果您想使用启用最新默认 mythweb.conf 选项的 MythWeb,您还需要在 httpd.conf 中取消注释以下行

LoadModule rewrite_module modules/mod_rewrite.so
LoadModule deflate_module modules/mod_deflate.so

您还需要启用 CGI,在 httpd.conf 中取消注释以下行

<IfModule !mpm_prefork_module>
        LoadModule cgid_module modules/mod_cgid.so
</IfModule>
<IfModule mpm_prefork_module>
        LoadModule cgi_module modules/mod_cgi.so
</IfModule>

编辑 mythweb.conf 以将其指向 mythweb 的安装目录(在文件开头附近)

<Directory "/srv/http/mythweb/data">
<Directory "/srv/http/mythweb" >

然后检查配置是否与您的 MythTV 设置匹配。如果您更改了数据库登录名或密码,您将需要更改以下部分。无论如何,请仔细检查以下行是否已取消注释

setenv db_server        "localhost"
setenv db_name          "mythconverg"
setenv db_login         "mythtv"
setenv db_password      "mythtv"

PHP

编辑 PHP 配置文件 /etc/php/php.ini

取消注释动态扩展部分中的以下行。

extension=mysqli

确保 open_basedir 包含 /srv/http//var/lib/mythtv/mythweb,以允许在 MythWeb 目录中进行文件操作。从 MythTV 0.23 开始,您还需要允许访问 /usr/share/mythtv/

open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/var/lib/mythtv/mythweb:/usr/share/mythtv/

启用 allow_url_fopen 选项,以使 MythWeb 的状态页面正常工作。

allow_url_fopen = On

设置 mythtv 目录的权限并创建到 mythweb 的链接

# chmod 755 -R /var/lib/mythtv/
# ln -s /var/lib/mythtv/mythweb /srv/http/

使用 MythWeb

您现在可以通过启动 httpd.service systemd 单元来启动 Apache 守护进程。mythbackend 必须已经在运行。

在您的浏览器中打开 MythWeb。

https://127.0.0.1/mythweb

保护 MythWeb 安全

如果您打算允许来自 Internet 的连接,那么为 MythWeb 设置密码保护可能也是一个好主意。要启用身份验证,请取消注释身份验证部分(在开头附近)

/etc/httpd/conf/extra/mythweb.conf
AuthType           Digest
AuthName           "MythTV"
AuthUserFile       /var/www/htdigest
Require            valid-user
BrowserMatch       "MSIE"      AuthDigestEnableQueryStringHack=On
Order              allow,deny
Satisfy            any

现在,我们需要修复配置以匹配 MythWeb 设置,将 AuthUserFile 更改为

AuthUserFile       /etc/httpd/conf/extra/httpd-passwords

如果您不想从 IE 访问 MythWeb,您可以删除 BrowserMatch 行。

您可能也不想在从本地计算机连接时输入密码,因此在最后两行之间添加以下行

Allow from 127. 192.168.1.

这将导致从您的本地计算机您的本地网络(如果您使用的是 192.168.1.0 255.255.255.0 子网)进行无密码访问

配置现在应该看起来像这样

AuthType           Digest
AuthName           "MythTV"
AuthUserFile       /etc/httpd/conf/extra/httpd-passwords
Require            valid-user
Order              allow,deny
Allow from 127. 192.168.1.
Satisfy            any

保存文件。

接下来,我们将创建 httpd-passwords 文件

# htdigest -c /etc/httpd/conf/extra/httpd-passwords MythTV myuser

其中myuser 是您要用于访问 MythWeb 的用户名。在提示时输入登录密码。

如果您需要更多用户,请省略 -c - 否则您将覆盖当前文件

# htdigest /etc/httpd/conf/extra/httpd-passwords MythTV myuser2

现在我们只需要重启 apache 的 httpd.service 以使更改生效。

故障排除

如果您收到 403 Forbidden 错误,请重新检查 mythweb.conf 中的路径

如果您无法启动 apache 服务,并且收到类似这样的错误

# journalctl -u httpd
...
AH00013: Pre-configuration failed
...

注释掉 httpd.conf 中的以下行

LoadModule mpm_event_module modules/mod_mpm_event.so

并使用 prefork 模块代替

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

参见