Welcome! Log In Create A New Profile

Advanced

Migrating Mythweb to Nginx

Posted by gnexus 
Migrating Mythweb to Nginx
September 23, 2011 10:55AM
Hello,

I have been happily using Nginx as my web server and reverse proxy on my main sites now for over a year. Those sites and nginx are running on a Buffalo WZR-HP-G300NH, and nginx on the router has very good response for the low traffic we have. So, before I outline my current issue, I would like again to thank Igor for his wonderful software, and for his prior help with me in the forum to repair my terrrible regex coding.

Recently I came across a Seagate Dockstar and a Seagate GoFlex Net at a low price. I decided that they would make better servers than the router, as they have 1.2GHz Marvell Kirkwood processors. So I loaded Debian armel distro on them and they work quite well. I am using the GoFlex Net, which has SATA, as a MythTV backend.

Unfortunately a problem arises when using the Mythweb browser interface. While most tasks, such as scheduling TV, work fine, there is a problem with certain tasks, such as displaying music in MythMusic and editing settings. I am certain it is an issue in either the nginx or the php-fpm configuration. If used with Apache Mythweb works fine. But Apache uses way too much resources for such a small machine. Currently I am using the standard nginx config as shown on the MythTV wiki at http://www.mythtv.org/wiki/MythWeb_on_Nginx. I am pasting the Mythweb Apache config and the nginx config below for comparison so that we may isolate the problem. The php.conf is separate, but is the same as normal. There are no errors being logged. I am assuming the problem is somewhere in the rewrite rules.
Thanks in advance for any assistance.

[code]

#mythweb.conf.apache

<Directory "/var/www/mythweb/data">
Options -All +FollowSymLinks +IncludesNoExec
</Directory>
<Directory "/var/www/mythweb" >

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

<Files *.php>

# These settings are intended for apache 2.x. If your version of apache
# doesn't support php_value, or things like memory_limit aren't working
# as expected, then use these settings as examples for your own php.ini
# files.
php_value safe_mode 0
php_value register_globals 0
php_value magic_quotes_gpc 0
php_value file_uploads 0
php_value allow_url_fopen On

php_value zlib.output_handler Off
php_value output_handler NULL

# If you have a large number of channels, you may need to increase this
# value to prevent PHP from running out of memory.
php_value memory_limit 64M

# Note: php_flag does not work in older versions of php
php_flag output_handler "NULL"

</Files>

# Turn on the rewrite engine
RewriteEngine on

# Skip out early if we've already been through rewrites,
# or if this is a /css/, /js/ or /cache/ directory request.
RewriteRule ^(css|data|images|js|themes|skins|README|INSTALL|[a-z_]+\.(php|pl))(/|$) - [L]

# Redirect /pl/ requests to the perl cgi handler.
RewriteRule ^(pl(/.*)?)$ mythweb.pl/$1 [QSA,L]

# Redirect most of the remaining URL requests to the main mythweb script.
# It will then handle any requests given to it.
RewriteRule ^(.+)$ mythweb.php/$1 [QSA,L]

# Catch anything else that comes through and send it to mythweb.php with no parameters.
RewriteRule ^(.*)$ mythweb.php [QSA,L]

# Allow .htaccess to override whatever it wants from the server config.
AllowOverride All

Options FollowSymLinks

<Files *.pl>
SetHandler cgi-script
Options +ExecCGI
</Files>
</Directory>

[/code]



[code]

#nginx.conf

server {
#listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
include php.conf;
root /var/www;
index index.html index.htm index.php;

# Make site accessible from http://localhost/
server_name localhost;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.html;
}

location /mythweb/ {
root /var/www;
# The two Auth Lines assume that you want to password protect - which is recommended
# auth_basic "Restricted";
# Supports a standard htpasswd file, which defaults to the same directory as nginx.conf
# auth_basic_user_file htpasswd;

if (!-e $request_filename) {
rewrite ^/mythweb/(pl(/.*)?)$ /mythweb/mythweb.pl?PATH_INFO=/$1 last;
rewrite ^/mythweb/(.+)$ /mythweb/mythweb.php?PATH_INFO=/$1 last;
}
if (!-f $request_filename) {
rewrite ^/mythweb/(.*)$ /mythweb/mythweb.php last;
}
}

[/code]
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 293
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready