Difference between revisions of "MythWeb on Lighttpd"

From MythTV Official Wiki
Jump to: navigation, search
 
Line 13: Line 13:
  
 
# second you specify the the needed variables
 
# second you specify the the needed variables
 +
[code]
 
setenv.add-environment = (
 
setenv.add-environment = (
 
   "db_server" => "localhost",
 
   "db_server" => "localhost",
Line 19: Line 20:
 
   "db_password" => "password"
 
   "db_password" => "password"
 
)
 
)
 +
[/code]
  
 
That should work, but doesn't for me, so here is how I did it:
 
That should work, but doesn't for me, so here is how I did it:

Revision as of 19:03, 31 May 2006

Ok, this will describe a way to get MythWeb working on lighttpd. This is not going to be an elegant solution, but at least it should work.

Ok, lets start.

Your MythWeb installation wont work on lighttpd because lighttpd doesnt read/understands the .htaccess file which is needed to set the database settings in the webservers environment as well as specifing the rewrite rules which are needed for MythWeb.

Lighttpd does in fact have support for rewriting and as well for enviroment settings, but the latter didnt work for me.

You can try yourself, just put the following into your lighttpd.conf

  1. first you need to load the setenv module

server.modules += ( mod_setenv )

  1. second you specify the the needed variables

[code] setenv.add-environment = (

 "db_server" => "localhost",
 "db_name" => "mythconverg",
 "db_login" => "mythtv_user",
 "db_password" => "password"

) [/code]

That should work, but doesn't for me, so here is how I did it:

1. Open the file includes/init.php in your MythWeb directory with the editor of your choice.

2. find the part of the file where the env variables are checked for the first time:

// No database connection info defined? if (empty($_SERVER['db_server']) || empty($_SERVER['db_name']) || empty($_SERVER['db_login'])) {

   require_once 'templates/_db_vars_error.php';
   exit;

} ...

3. enter the following ABOVE the part you found in step 2:

$_SERVER["db_server"] = "localhost"; $_SERVER["db_name"] = "mythconverg"; $_SERVER["db_login"] = "mythtv_user"; $_SERVER["db_password"] = "password";

After that, mythweb should find and be able to connect to the database.

But things will be still screwed up, cause there are no rewrite rules.

So, now we are going to specify those in the file lighttpd.conf.

  1. make sure the rewrite module is loaded

server.modules += ( "mod_rewrite" )

  1. the actual rewrite rule

url.rewrite = ( "^(/tv.*|/video.*|/weather.*|/settings.*|/status.*)$" => "mythweb.php/$1" )

This rule assumes that the mythweb dir is the actual server root. If it isn't you may want to create a virtual host like this:

$HTTP["host"] == "mythweb.some.domain" {

 server.document-root = "/var/www/mythweb"
 index-file.names = ("mythweb.php")
 url.rewrite-once = (
   "^(/tv.*|/video.*|/weather.*|/settings.*|/status.*)$" =>  "mythweb.php/$1"
 )

}

You may wonder if you could just take the rewrite rules from the .htaccess file and use those. Well, i thought so too, and the guys in #lighttpd said in should work, but it didnt...

Anyways, here is what it should look like if you want to try it out anyway:

url.rewrite-once = (

 "^(css|data|images|js|themes|skins|[a-z_]+\.php)(/|$)" =>  "$0",
 "^(.+)$" => "mythweb.php/$1",
 "^(.*)$" => "mythweb.php"

)

The $0 is needed instead of the "-" according to #lighttpd... and thats the only difference.