Difference between revisions of "MythWeb"

From ArchWiki
Jump to: navigation, search
m (Minor update for the new php packages.)
m (Corrected the directory pointer. Previous value didn't work and wasn't consistent with the rest of the instructions.)
(13 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{translateme}}
+
[[Category:Audio/Video]]
= MythWeb =
+
 
+
== Introduction ==
+
 
MythWeb is a web interface for [[MythTV]]
 
MythWeb is a web interface for [[MythTV]]
  
 
== Installation ==
 
== Installation ==
 
Install MythWeb
 
Install MythWeb
  # pacman -S mythweb
+
  # pacman -S mythplugins-mythweb
  
 
You will also need to install php-apache, the MythWeb package has not yet been updated to depend on this.
 
You will also need to install php-apache, the MythWeb package has not yet been updated to depend on this.
 
  # pacman -S php-apache
 
  # pacman -S php-apache
 
=== Change Owner and Group ===
 
The files of the ''mythweb'' package will be owned by the ''nobody'' user and group. Apache now uses the ''http'' user and group.  You can change the owner of ''mythweb'' with:
 
# chown -R http:http /srv/www/mythweb
 
 
=== Link to the MythWeb  Directory ===
 
The ''mythweb'' package will install to ''/srv/www/mythweb'' however the ''apache'' package now uses the ''/srv/httpd'' directory. You can create a link with:
 
# ln -s /srv/www/mythweb /srv/http/mythweb
 
  
 
=== Link to the Video Directory ===
 
=== Link to the Video Directory ===
 
MythWeb looks in the ''video_dir'' directory for ''[[MythTV]]'' recordings. You will need to create a link to the folder where your MythTV recordings are stored.
 
MythWeb looks in the ''video_dir'' directory for ''[[MythTV]]'' recordings. You will need to create a link to the folder where your MythTV recordings are stored.
  # ln -s <recording_dir> /srv/http/mythweb/video_dir
+
  # ln -s <recording_dir> /var/lib/mythtv/mythweb/video_dir
  
 
== Configuration ==
 
== Configuration ==
 
=== MythWeb ===
 
=== MythWeb ===
 
Copy the MythWeb configuration file ''mythweb.conf'' to the [[Apache]] configuration directory.
 
Copy the MythWeb configuration file ''mythweb.conf'' to the [[Apache]] configuration directory.
  # cp /srv/www/mythweb/mythweb.conf.apache  /etc/httpd/conf/extra/mythweb.conf
+
  # cp /var/lib/mythtv/mythweb/mythweb.conf.apache  /etc/httpd/conf/extra/mythweb.conf
 +
 
 +
Edit ''mythweb.conf'' to point it to the directory where you'll be installing mythweb (near the beginning of the file).
 +
<Directory "/srv/http/mythweb/data">
  
Edit ''mythweb.conf'' to point it to the correct installation directory (near the beginning of the file).
 
 
  <Directory "/srv/http/mythweb" >
 
  <Directory "/srv/http/mythweb" >
  
Line 41: Line 32:
 
Edit the ''[[Apache]]'' configuration file ''/etc/httpd/conf/httpd.conf''
 
Edit the ''[[Apache]]'' configuration file ''/etc/httpd/conf/httpd.conf''
  
Uncomment (or add) the line
+
Uncomment (or add) the line to the LoadModule section
 
  LoadModule php5_module modules/libphp5.so
 
  LoadModule php5_module modules/libphp5.so
  
Line 55: Line 46:
 
  extension=posix.so
 
  extension=posix.so
  
Add ''/srv/www/'' to the ''open_basedir'' option to allow file operation in the MythWeb directory.
+
Make sure ''open_basedir'' contains ''/srv/http/'' and ''/var/lib/mythtv/mythweb'' to allow file operation in the MythWeb directory.  Starting with MythTV 0.23, you will also need to permit access to ''/usr/share/mythtv/''.
  open_basedir = /srv/http/:/srv/www/:/home/:/tmp/:/usr/share/pear/
+
  open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/var/lib/mythtv/mythweb:/usr/share/mythtv/
  
 
Enable the ''allow_url_fopen'' option for MythWeb's status page to work.
 
Enable the ''allow_url_fopen'' option for MythWeb's status page to work.
 
  allow_url_fopen = On
 
  allow_url_fopen = On
 +
 +
== Set rights for mythtv dir and create the link to mythweb ==
 +
chmod 755 /var/lib/mythtv/
 +
 +
ln -s /var/lib/mythtv/mythweb /srv/http/
  
 
== Using MythWeb ==
 
== Using MythWeb ==
 
You can now start the Apache daemon, ''mythbackend'' must already be running.
 
You can now start the Apache daemon, ''mythbackend'' must already be running.
  /etc/rc.d/httpd start
+
  systemctl start httpd.service
  
 
Open MythWeb in your browser.
 
Open MythWeb in your browser.
Line 80: Line 76:
 
Now we need to fix the configuration to match how we have MythWeb set up, change the ''AuthUserFile'' so it reads
 
Now we need to fix the configuration to match how we have MythWeb set up, change the ''AuthUserFile'' so it reads
 
  AuthUserFile      /etc/httpd/conf/extra/httpd-passwords
 
  AuthUserFile      /etc/httpd/conf/extra/httpd-passwords
If you don't want to access MythWeb from IE you can delete the BrowserMatch line.
+
If you do not want to access MythWeb from IE you can delete the BrowserMatch line.
  
You also probably don't want to have to enter your password when you're connecting from your local computer, so add the following line between the last two lines:
+
You also probably do not want to have to enter your password when you're connecting from your local computer, so add the following line between the last two lines:
 
  Allow from 127. 192.168.1.
 
  Allow from 127. 192.168.1.
 
This will cause passwordless access from both your local machine <b>AND</b> your local network (provided you're using the 192.168.1.0 255.255.255.0 subnet)
 
This will cause passwordless access from both your local machine <b>AND</b> your local network (provided you're using the 192.168.1.0 255.255.255.0 subnet)
Line 96: Line 92:
 
Save the file.
 
Save the file.
 
Now we'll create the httpd-passwords file,  
 
Now we'll create the httpd-passwords file,  
  # htdigest -c /etc/httpd/conf/httpd-passwords MythTV MYUSER
+
  # htdigest -c /etc/httpd/conf/extra/httpd-passwords MythTV MYUSER
 
Where MYUSER is the username you want to use to access MythWeb.  Enter the login password when prompted.
 
Where MYUSER is the username you want to use to access MythWeb.  Enter the login password when prompted.
  
 
If you need more users:
 
If you need more users:
  # htdigest /etc/httpd/conf/httpd-passwords MythTV MYUSER
+
  # htdigest /etc/httpd/conf/extra/httpd-passwords MythTV MYUSER
 
NOTE: No -c after initial user, otherwise you will overwrite the current file.
 
NOTE: No -c after initial user, otherwise you will overwrite the current file.
  
 
Now all we need to do now is restart the apache server for the changes to take effect.
 
Now all we need to do now is restart the apache server for the changes to take effect.
 
  # /etc/rc.d/httpd restart
 
  # /etc/rc.d/httpd restart
 +
 +
== Troubleshooting ==
 +
If you get a 403 Forbidden error, recheck your paths in mythweb.conf
  
 
= External Links =
 
= External Links =
 
* [http://www.mythtv.org/wiki/MythWeb MythTV Wiki page on MythWeb]
 
* [http://www.mythtv.org/wiki/MythWeb MythTV Wiki page on MythWeb]

Revision as of 01:09, 15 November 2013

MythWeb is a web interface for MythTV

Installation

Install MythWeb

# pacman -S mythplugins-mythweb

You will also need to install php-apache, the MythWeb package has not yet been updated to depend on this.

# pacman -S php-apache

Link to the Video Directory

MythWeb looks in the video_dir directory for MythTV recordings. You will need to create a link to the folder where your MythTV recordings are stored.

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

Configuration

MythWeb

Copy the MythWeb configuration file mythweb.conf to the Apache configuration directory.

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

Edit mythweb.conf to point it to the directory where you'll be installing mythweb (near the beginning of the file).

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

Then check that the configuration matches your MythTV setup. If you have changed the database login or password you will need to change the following section.

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

Apache

Edit the Apache configuration file /etc/httpd/conf/httpd.conf

Uncomment (or add) the line to the LoadModule section

LoadModule php5_module modules/libphp5.so

Insert the following two lines in the Supplemental Configuration section of httpd.conf, it's found towards the end of the file.

Include conf/extra/php5_module.conf
Include conf/extra/mythweb.conf

PHP

Edit the PHP configuration file /etc/php/php.ini

Uncomment the following lines in the Dynamic extensions section.

extension=mysql.so
extension=posix.so

Make sure open_basedir contains /srv/http/ and /var/lib/mythtv/mythweb to allow file operation in the MythWeb directory. Starting with MythTV 0.23, you will also need to permit access to /usr/share/mythtv/.

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

Enable the allow_url_fopen option for MythWeb's status page to work.

allow_url_fopen = On

Set rights for mythtv dir and create the link to mythweb

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

Using MythWeb

You can now start the Apache daemon, mythbackend must already be running.

systemctl start httpd.service

Open MythWeb in your browser.

http://localhost/mythweb

Securing MythWeb

It is also probably a good idea to set up password protection for MythWeb if you intend to allow connections from the Internet. To enable authentication open the /etc/httpd/conf/extra/mythweb.conf file and uncomment the authentication section (near the beginning):

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

Now we need to fix the configuration to match how we have MythWeb set up, change the AuthUserFile so it reads

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

If you do not want to access MythWeb from IE you can delete the BrowserMatch line.

You also probably do not want to have to enter your password when you're connecting from your local computer, so add the following line between the last two lines:

Allow from 127. 192.168.1.

This will cause passwordless access from both your local machine AND your local network (provided you're using the 192.168.1.0 255.255.255.0 subnet)

Your config should now look something like:

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

Save the file. Now we'll create the httpd-passwords file,

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

Where MYUSER is the username you want to use to access MythWeb. Enter the login password when prompted.

If you need more users:

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

NOTE: No -c after initial user, otherwise you will overwrite the current file.

Now all we need to do now is restart the apache server for the changes to take effect.

# /etc/rc.d/httpd restart

Troubleshooting

If you get a 403 Forbidden error, recheck your paths in mythweb.conf

External Links