Config - Novik/ruTorrent GitHub Wiki
Installation and configuration of ruTorrent
Installation
Simply download and unpack archive to the web server root directory. All resulting files must be accessible for reading from web server user.
Directory ruTorrent/share
(with all its contents) must be accessible for reading and writing for both rtorrent and web server users.
Configuration
The base install comes with 3 config files:
config.php
access.ini
plugins.ini
Plugins may have their own configuration files, in common case, this is a file conf.php
inside plugins directory.
config.php
This file is the probably the most important config file in the ruTorrent base install. It controls many options. By default, it looks like this:
<?php
// configuration parameters
// for snoopy client
@define('HTTP_USER_AGENT', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36', true);
@define('HTTP_TIME_OUT', 30, true); // in seconds
@define('HTTP_USE_GZIP', true, true);
$httpIP = null; // IP string. Or null for any.
$httpProxy = array
(
'use' => false,
'proto' => 'http', // 'http' or 'https'
'host' => 'PROXY_HOST_HERE',
'port' => 3128
);
@define('RPC_TIME_OUT', 5, true); // in seconds
@define('LOG_RPC_CALLS', false, true);
@define('LOG_RPC_FAULTS', true, true);
// for php
@define('PHP_USE_GZIP', false, true);
@define('PHP_GZIP_LEVEL', 2, true);
$schedule_rand = 10; // rand for schedulers start, +0..X seconds
$do_diagnostic = true;
$log_file = '/tmp/errors.log'; // path to log file (comment or leave blank to disable logging)
$saveUploadedTorrents = true; // Save uploaded torrents to profile/torrents directory or not
$overwriteUploadedTorrents = false; // Overwrite existing uploaded torrents in profile/torrents directory or make unique name
$topDirectory = '/'; // Upper available directory. Absolute path with trail slash.
$forbidUserSettings = false;
$scgi_port = 5000;
$scgi_host = "127.0.0.1";
// For web->rtorrent link through unix domain socket
// (scgi_local in rtorrent conf file), change variables
// above to something like this:
//
// $scgi_port = 0;
// $scgi_host = "unix:///tmp/rpc.socket";
$XMLRPCMountPoint = "/RPC2"; // DO NOT DELETE THIS LINE!!! DO NOT COMMENT THIS LINE!!!
$pathToExternals = array(
"php" => '', // Something like /usr/bin/php. If empty, will be found in PATH.
"curl" => '', // Something like /usr/bin/curl. If empty, will be found in PATH.
"gzip" => '', // Something like /usr/bin/gzip. If empty, will be found in PATH.
"id" => '', // Something like /usr/bin/id. If empty, will be found in PATH.
"stat" => '', // Something like /usr/bin/stat. If empty, will be found in PATH.
);
$localhosts = array( // list of local interfaces
"127.0.0.1",
"localhost",
);
$profilePath = '../../share'; // Path to user profiles
$profileMask = 0777; // Mask for files and directory creation in user profiles.
// Both Webserver and rtorrent users must have read-write access to it.
// For example, if Webserver and rtorrent users are in the same group then the value may be 0770.
$tempDirectory = null; // Temp directory. Absolute path with trail slash. If null, then autodetect will be used.
$canUseXSendFile = false; // If true then use X-Sendfile feature if it exist
$locale = "UTF8";
Link to rtorrent
$scgi_host = "127.0.0.1";
SCGI Host - This will almost always be 127.0.0.1 (unless using unix based socket, in which case it would be something like $scgi_host = "unix:///tmp/rpc.socket";
). If you use IPv6, remember to put the IP between square brackets, i.e. [::1]
.
$scgi_port = 5000;
SCGI port - This is the scgi port. For multi-user setups, each user would get a different port number (unless you are using unix based sockets)
$XMLRPCMountPoint = "/RPC2";
XMLRPC Mount Point - This defaults to /RPC2
but can be set to anything inside your webspace. If you are setting up multiple users, each user would get a different setting here. This setting is required, don't remove it.
Diagnostic
$do_diagnostic = true;
If this is false, some diagnostics (permission checking, for example) will be skipped. This is true by default.
$log_file = '/tmp/errors.log';
Log file path for some errors messages etc. if you wish to disable this, simply change it to $log_file = '';
.
Others
$httpIP = null;
ruTorrent will use this IP address for access to the external http and https resources (for example, to the RSS feeds).
$forbidUserSettings = false;
If true, allows for single user style configuration, even with webauth.
@define('PHP_USE_GZIP', false, true);
This option enables or disables usage of the external gzip binary. If changed from false to true - all php generated pages > 2K will be gzipped by the external 'gzip' binary. This
- Decreases traffic (bandwidth)
- Increases server load (cpu time and memory use)
- Can't be used if php is already being compressed (for example, if zlib.output_compression is on)
@define('PHP_GZIP_LEVEL', 2, true);
This option controls the compression level of the above 'gzip' option
$saveUploadedTorrents = true;
If true, all .torrent files added via webui will be saved in share/torrents
(or share/users/USERNAME/torrents
). If false, all .torrent files will be deleted after being added.
$overwriteUploadedTorrents = false;
If true, then already existing .torrent files will be overwritten. Otherwise new files will have unique names.
$topDirectory = '/';
Chroot directory for user. Users have no access to directories above this directory.
- External Program Paths
$pathToExternals = array(
"php" => '', // Something like /usr/bin/php. If empty, will be founded in PATH.
"curl" => '', // Something like /usr/bin/curl. If empty, will be founded in PATH.
"gzip" => '', // Something like /usr/bin/gzip. If empty, will be founded in PATH.
"id" => '', // Something like /usr/bin/id. If empty, will be founded in PATH.
This should be pretty self explanatory. Set each option with the proper binary path.
$profilePath = '../../share';
Path to the directory for users data.
$profileMask = 0777;
Access mask for creation of user's files and directories. Both rtorrent and web server users must have access for reading/writing to these files. As result, if, for example, these users have the same primary group, this parameter should be changed to 0770.
$tempDirectory = null;
The directory for creation of temporary files. This directory must be accessible for reading/writing/execution for both rtorrent and web server users. By default ruTorrent will check
upload_tmp_dir
from php.ini- result of php function
sys_get_temp_dir
- /tmp
and select first applicable directory from this list.
access.ini
File is intended for limiting a user's access to specific settings of ruTorrent. This is a simple ini file.
;; 1
;; ruTorrent permissions.
;; All flags are assumed to be yes by default.
[settings]
showDownloadsPage = yes
showConnectionPage = yes
showBittorentPage = yes
showAdvancedPage = yes
[tabs]
showPluginsTab = yes
[statusbar]
canChangeULRate = yes
canChangeDLRate = yes
[dialogs]
canChangeTorrentProperties = yes
canAddTorrentsWithoutPath = yes
canAddTorrentsWithoutStarting = yes
canAddTorrentsWithResume = yes
canAddTorrentsWithRandomizeHash = yes
These options are pretty self explanatory.
plugins.ini
File is intended for plugins control. This is a simple ini file.
;; Plugins' permissions.
;; If flag is not found in plugin section, corresponding flag from "default" section is used.
;; If flag is not found in "default" section, it is assumed to be "yes".
;;
;; For setting individual plugin permissions you must write something like that:
;;
;; [ratio]
;; enabled = yes ;; also may be "user-defined", in this case user can control plugin's state from UI
;; canChangeToolbar = yes
;; canChangeMenu = yes
;; canChangeOptions = no
;; canChangeTabs = yes
;; canChangeColumns = yes
;; canChangeStatusBar = yes
;; canChangeCategory = yes
;; canBeShutdowned = yes
[default]
enabled = user-defined
canChangeToolbar = yes
canChangeMenu = yes
canChangeOptions = yes
canChangeTabs = yes
canChangeColumns = yes
canChangeStatusBar = yes
canChangeCategory = yes
canBeShutdowned = yes
Every section in this file (exclude section 'default') corresponds to a concrete plugin. If section with a plugins name is absent, then the section 'default' will be used.
enabled
- whether the plugin will be used generally. Available values - yes, no, user-defined. The last means that the decision on loading / not to loading of a plugin is accepted by the user and is available from the ruTorrent interface (see the shortcut menu on the Plugins tab).canChangeToolbar
- whether the plugin can change contents of the main toolbar.canChangeMenu
- whether the plugin can change contents of the context menu.canChangeOptions
- whether the plugin can change contents of the Options dialog.canChangeTabs
- whether the plugin can add a new tabs.canChangeColumns
- whether the plugin can change structure of tables (for example, list of torrents).canChangeStatusBar
- whether the plugin can change contents of the status bar.canChangeCategory
- whether the plugin can change categories.canBeShutdowned
- whether the unload command is available to this plugin on the interface.
Example:
[default]
enabled = yes
canChangeToolbar = yes
canChangeMenu = yes
canChangeOptions = yes
canChangeTabs = yes
canChangeColumns = yes
[rpc]
enabled = no
[unpack]
canChangeOptions = no
As result, plugin RPC will not be loaded, and for plugin Unpack user can't use automatic unpacking (because corresponding option should be turned on from the Options dialog).
Authentication
Authentication - Currently ruTorrent does not have any sort of authentication. For authentication, use whatever your webserver supports.
You must protect root directory of ruTorrent and, if you don't use plugins RPC or HTTPRPC, then XMLRPC mount point (by default /RPC2
).
Authentication of both parts must have a same realm (or you can simply move XMLRPC mount point inside ruTorrent directory and protect only one part).
If you have authentication, then you can configure ruTorrent to work with several users.
Note: Every user should have a their own rtorrent instance. Otherwise some plugins will not work.
Multiuser and singleuser configuration
If you don't use authentication, or turned off multiuser configuration manually, then
- All users data will be stored inside
share/settings
directory. - All ruTorrent configuration will be read from
ruTorrent/conf
directory.
Otherwise, you have a multiuser configuration. For it
- All users data will be stored inside
share/users/USERNAME/settings
directory, whereUSERNAME
- his login. - You can configure ruTorrent for each user separately.
For that you should copy corresponding ruTorrent config files to the conf/users/USERNAME
directory (you must create it manually).
For example, if you have three users - tom, dick and harry, you should make something like:
mkdir /var/www/ruTorrent/conf/users/tom
mkdir /var/www/ruTorrent/conf/users/dick
mkdir /var/www/ruTorrent/conf/users/harry
cp /var/www/ruTorrent/conf/* /var/www/ruTorrent/conf/users/tom/
cp /var/www/ruTorrent/conf/* /var/www/ruTorrent/conf/users/dick/
cp /var/www/ruTorrent/conf/* /var/www/ruTorrent/conf/users/harry/
After that don't forget to edit files config.php
, access.ini
and plugins.ini
inside users directory.
Note: In any case ruTorrent will load main file conf/config.php
. And only after that - users config file. As result, users config file may contain only difference from the main config file. This technique is not applicable to the files access.ini
and plugins.ini
.
Some plugins may have their own configuration files, and you also can configure them separately for each user.