Difference between revisions of "Webserver"

From AMule Project FAQ
Jump to: navigation, search
m (Reverted edit of 80.58.34.237, changed back to last version by Jacobo221)
(not finished. just saving to make sure i don't loose what ive laredy done ;))
Line 1: Line 1:
== How to setup a Webserver with [[aMule]] 2.0.0rc1 and later: ==
+
== How to setup a [[aMuleWeb|Webserver]] with [[aMule]] 2.0.0rc1 and later ==
  
When you installed your [[aMule]] via deb package or rpm, the [[aMuleWeb|webserver]] source is not included.
+
=== Previous notes ===
Please visit http://www.amule.org and download the tar.gz package for your [[aMule]] version.
+
  
 +
If you installed [[aMule]] via [http://www.debian.org deb] or [http://www.rpm.org RPM] package, the [[aMuleWeb|webserver]] source is not included.
 +
Since some few files are needed from the sources to set-up [[aMuleWeb]], please visit http://www.amule.org and download the tar.gz package for your [[aMule]] version.
  
 +
=== Setting up [[aMuleWeb]] ===
  
'''SETUP'''
+
*[http://www.gnu.org/software/tar/tar.html Untar] the sources and copy ''src/aMule.tmpl'' and ''src/webserver/'' into your ''~/.aMule/'' directory. The following (run from the sources directory), should do so:
 +
:''cp -r src/aMule.tmpl src/webserver/ ~/.aMule/''
  
0) Untar it and copy from the src directory:
+
*Shutdown [[aMule]] if it is still running.
*''aMule.tmpl''
+
*And the [[aMuleWeb|webserver]] directory
+
into your ''/home/usr_running_aMule/.aMule/'' directory.  
+
  
1) Shutdown your [[aMule]] if it is still running
+
*Edit your ''~/.eMule'' file:
 
+
2) Edit your ''~/.eMule'' file:
+
 
*Locate the ''[ExternalConnect]'' section and change:
 
*Locate the ''[ExternalConnect]'' section and change:
**''AcceptExternalConnections=1'' <-- To enable [[aMule]] listening for [[External Connections]]
+
**''AcceptExternalConnections=1'' <-- To enable [[aMule]] listening for [[External Connections]].
**''ECUseTCPPort=1'' <-- To use the TCP port! Very important since Unix sockets are disabled  
+
**''ECUseTCPPort=1'' <-- To use the [http://www.faqs.org/faqs/internet/tcp-ip/resource-list TCP] port. Very important since [http://www.unix.org Unix] sockets are disabled.
  
3) Restart [[aMule]]
+
*Restart [[aMule]]
  
 
4) Go to your Preferences -> Remote Connection (in [[aMule]]):
 
4) Go to your Preferences -> Remote Connection (in [[aMule]]):
Line 52: Line 50:
 
However, on previous [[aMule]] releases, although [[aMuleWeb]] works well, it's actually quite tricky to run it in the background because it's continuously asking for user commands and showing the prompt. The obvious way to avoid this would be running amuleweb with the output redirected to ''/dev/null'', but this hogs the CPU due to the constant writing, so a better approach is to use the program [http://directory.fsf.org/GNU/screen.html screen], which is a terminal emulator. In order to run [[aMuleWeb]] inside a virtual terminal, the following command should be executed: ''screen -d -m -S amulewebsession amuleweb -p 7000 -pw password'' (assuming that [[aMule]] is listening for [[External Connections]] on port ''7000'' and the password is ''password''). Then, [[aMuleWeb]] will start listening for HTTP connections, but will show the prompt and all messages in this virtual terminal. It's possible to switch to this terminal using the command ''screen -r amulewebsession'', please refer to [http://directory.fsf.org/GNU/screen.html screen] documentation for info about session switching, internal commands, etc.
 
However, on previous [[aMule]] releases, although [[aMuleWeb]] works well, it's actually quite tricky to run it in the background because it's continuously asking for user commands and showing the prompt. The obvious way to avoid this would be running amuleweb with the output redirected to ''/dev/null'', but this hogs the CPU due to the constant writing, so a better approach is to use the program [http://directory.fsf.org/GNU/screen.html screen], which is a terminal emulator. In order to run [[aMuleWeb]] inside a virtual terminal, the following command should be executed: ''screen -d -m -S amulewebsession amuleweb -p 7000 -pw password'' (assuming that [[aMule]] is listening for [[External Connections]] on port ''7000'' and the password is ''password''). Then, [[aMuleWeb]] will start listening for HTTP connections, but will show the prompt and all messages in this virtual terminal. It's possible to switch to this terminal using the command ''screen -r amulewebsession'', please refer to [http://directory.fsf.org/GNU/screen.html screen] documentation for info about session switching, internal commands, etc.
  
For Problems or Questions just report on [http://forum.amule.org forum] or join [[IRC]] channel #amule at irc.freenode.net
+
For Problems or Questions just report on http://forum.amule.org forum or join [[IRC]] channel [irc://irc.freenode.net/amule #amule] at [irc://irc.freenode.net irc.freenode.net]
 +
 
 +
'''[[User:Stefanero|Stefanero]]'''
 +
 
 +
== How to setup a [[aMuleWeb|Webserver]] with [[aMule]] 1.2.8 or earlier ==
 +
 
 +
The following is based on the original instruction by BigBob. They guide you on how to modify [[aMule]]'s configuration files to set [[aMuleWeb]] correctly. There is "Preferences"->"Remote Controls" now, but anyway, information is never a bad idea.
 +
 
 +
*Shutdown [[aMule]] to avoid overwritting config files while shutting down.
 +
 
 +
*Copy from [[aMule]]'s sources (version 1.2.4 or later) the directory ''src/webserver/'' into your ''~/.aMule/webserver/'' directory.
 +
 
 +
*Copy from [[aMule]]'s sources (version 1.2.4 or later) the file ''src/aMule.tmpl'' into your ''~/.aMule/aMule.tmpl'' directory.
 +
 
 +
*Open a terminal and type (you might have to install ''md5sum''):
 +
 
 +
:''echo -n "'''THEPASWORDYOUWANT'''" | md5sum | cut -d " " -f 1''
 +
This reply with an [[MD5]] hash. Something like: 324f85f6095f9e5fe25b6c85af44b445
 +
 
 +
*Edit your ''~/.eMule'' file, locate the ''[ExternalConnect]'' section in it and change this fields:
 +
 
 +
:''AcceptExternalConnections=1'' <- To enable [[aMule]] to listen for external connections.
 +
:''ECUseTCPPort=0'' <- 0/1 (disable/enable) the use of a [http://www.faqs.org/faqs/internet/tcp-ip/resource-list TCP] port (if disabled use a [http://www.unix.org Unix] socket in your ''~/.aMule/muleconn'') for External Connections.
 +
:''ECPort=4712'' <- Put here the port on which you want [[aMule]] to listen for External Connections.
 +
:''ECPassword=39e5049d0614baf21906500e2261d500'' <- Put here the password for External Connections<nowiki>'</nowiki> authentications you generated before in terminal (something like 324f85f6095f9e5fe25b6c85af44b445).
 +
 
 +
*Edit your ''~/.eMule'' file, locate the ''[WebServer]'' section in it and change fields:
 +
 
 +
:''Password=324f85f6095f9e5fe25b6c85af44b445'' <- Put here the password generated in term for the admin (full privileged users).
 +
:''PasswordLow=1db5a746266e941b3ef7dd3586863ca7'' <- Put here the password generated in term for "low users" (low privileged users).
 +
:''Port=10000'' <- Put the port you want [[aMuleWeb]] to listen on.
 +
:''Enabled=1'' <- This option has been deprecated and is completly ignored now. Enabling External Connections will enable any application it connects to it, including [[aMuleWeb]].
 +
:''UseGzip=1'' <- Enable compression on communication.
 +
:''PageRefreshTime=120'' <- Put here the web page refresh time (in seconds).
 +
:''UseLowRightsUser=0'' <- 0/1 (disabled/enabled) "low user" access.
 +
 
 +
*Restart [[aMule]].
 +
 
 +
*Once [[aMule]] is running, start the web interface ([[aMuleWeb]]).
 +
 
 +
*Now point your web browser to http://localhost:10000 (or whatever your host and ports are) and authenticate yourself with "Password" (for full privileged user) or "PasswordLow" (for low privileged user, if enabled).
 +
 
 +
*That's all :)
 +
 
 +
'''NOTE:'' In latest [[aMule]] 1.2.x releases, the option ''WebTemplateFile'' allows to override the file template to use (thanks to [[User:Stefanero|Stefanero]]. You can set this option in the ''[eMule]]'' section. Example:
  
 +
''WebTemplateFile=eMule.tmpl''
  
'''Stefanero'''
+
''Shakraw''

Revision as of 00:24, 12 November 2004

How to setup a Webserver with aMule 2.0.0rc1 and later

Previous notes

If you installed aMule via deb or RPM package, the webserver source is not included. Since some few files are needed from the sources to set-up aMuleWeb, please visit http://www.amule.org and download the tar.gz package for your aMule version.

Setting up aMuleWeb

  • Untar the sources and copy src/aMule.tmpl and src/webserver/ into your ~/.aMule/ directory. The following (run from the sources directory), should do so:
cp -r src/aMule.tmpl src/webserver/ ~/.aMule/
  • Shutdown aMule if it is still running.
  • Edit your ~/.eMule file:
  • Locate the [ExternalConnect] section and change:
    • AcceptExternalConnections=1 <-- To enable aMule listening for External Connections.
    • ECUseTCPPort=1 <-- To use the TCP port. Very important since Unix sockets are disabled.

4) Go to your Preferences -> Remote Connection (in aMule):

5) After you are done, save your settings, go to console and type

at the end it should look something like this: Web Server: Started

amuleweb$

WSThread: Thread started

WSThread: created service

WSThread: created socket listening on :4711

6) To make sure it is working use your favorite browser to browse:

NOTE: This (port 4711) is the default port of your aMuleWeb. If you connect to 4712 this will not work since it is the External Connections port, so connecting here will result in error messages by aMule.

NOTE: Since aMule 2.0.0-rc6, aMuleWeb supports --quiet switch (or -q also) which renders allows aMuleWeb to be easily run on the background.
However, on previous aMule releases, although aMuleWeb works well, it's actually quite tricky to run it in the background because it's continuously asking for user commands and showing the prompt. The obvious way to avoid this would be running amuleweb with the output redirected to /dev/null, but this hogs the CPU due to the constant writing, so a better approach is to use the program screen, which is a terminal emulator. In order to run aMuleWeb inside a virtual terminal, the following command should be executed: screen -d -m -S amulewebsession amuleweb -p 7000 -pw password (assuming that aMule is listening for External Connections on port 7000 and the password is password). Then, aMuleWeb will start listening for HTTP connections, but will show the prompt and all messages in this virtual terminal. It's possible to switch to this terminal using the command screen -r amulewebsession, please refer to screen documentation for info about session switching, internal commands, etc.

For Problems or Questions just report on http://forum.amule.org forum or join IRC channel #amule at irc.freenode.net

Stefanero

How to setup a Webserver with aMule 1.2.8 or earlier

The following is based on the original instruction by BigBob. They guide you on how to modify aMule's configuration files to set aMuleWeb correctly. There is "Preferences"->"Remote Controls" now, but anyway, information is never a bad idea.

  • Shutdown aMule to avoid overwritting config files while shutting down.
  • Copy from aMule's sources (version 1.2.4 or later) the directory src/webserver/ into your ~/.aMule/webserver/ directory.
  • Copy from aMule's sources (version 1.2.4 or later) the file src/aMule.tmpl into your ~/.aMule/aMule.tmpl directory.
  • Open a terminal and type (you might have to install md5sum):
echo -n "THEPASWORDYOUWANT" | md5sum | cut -d " " -f 1

This reply with an MD5 hash. Something like: 324f85f6095f9e5fe25b6c85af44b445

  • Edit your ~/.eMule file, locate the [ExternalConnect] section in it and change this fields:
AcceptExternalConnections=1 <- To enable aMule to listen for external connections.
ECUseTCPPort=0 <- 0/1 (disable/enable) the use of a TCP port (if disabled use a Unix socket in your ~/.aMule/muleconn) for External Connections.
ECPort=4712 <- Put here the port on which you want aMule to listen for External Connections.
ECPassword=39e5049d0614baf21906500e2261d500 <- Put here the password for External Connections' authentications you generated before in terminal (something like 324f85f6095f9e5fe25b6c85af44b445).
  • Edit your ~/.eMule file, locate the [WebServer] section in it and change fields:
Password=324f85f6095f9e5fe25b6c85af44b445 <- Put here the password generated in term for the admin (full privileged users).
PasswordLow=1db5a746266e941b3ef7dd3586863ca7 <- Put here the password generated in term for "low users" (low privileged users).
Port=10000 <- Put the port you want aMuleWeb to listen on.
Enabled=1 <- This option has been deprecated and is completly ignored now. Enabling External Connections will enable any application it connects to it, including aMuleWeb.
UseGzip=1 <- Enable compression on communication.
PageRefreshTime=120 <- Put here the web page refresh time (in seconds).
UseLowRightsUser=0 <- 0/1 (disabled/enabled) "low user" access.
  • Now point your web browser to http://localhost:10000 (or whatever your host and ports are) and authenticate yourself with "Password" (for full privileged user) or "PasswordLow" (for low privileged user, if enabled).
  • That's all :)

'NOTE: In latest aMule 1.2.x releases, the option WebTemplateFile allows to override the file template to use (thanks to Stefanero. You can set this option in the [eMule]] section. Example:

WebTemplateFile=eMule.tmpl

Shakraw