2011-07-01 19:03:35 +02:00
|
|
|
*********************
|
|
|
|
Using the HTTP server
|
|
|
|
*********************
|
|
|
|
|
|
|
|
Configuration
|
|
|
|
=============
|
|
|
|
|
2015-01-27 15:39:08 +01:00
|
|
|
The HTTP server comes with a couple of additional variables:
|
2011-07-01 19:03:35 +02:00
|
|
|
|
2014-07-27 14:03:12 +02:00
|
|
|
* :ref:`supybot.servers.http.favicon`: Path to the file which is shown to
|
|
|
|
browsers as favicon.
|
|
|
|
* :ref:`supybot.servers.http.hosts4`: The IPv4 addresses where the bot
|
|
|
|
will bind. In most of the cases, you will use 0.0.0.0 (everything) or
|
|
|
|
127.0.0.1 (restricted to local connections). Defaults to 0.0.0.0
|
|
|
|
* :ref:`supybot.servers.http.hosts6`: The IPv6 addresses where the bot
|
|
|
|
will bind. Defaults to empty.
|
2015-01-27 15:39:08 +01:00
|
|
|
* :ref:`supybot.servers.http.keepAlive`: Determines whether the HTTP server
|
2014-07-27 14:03:12 +02:00
|
|
|
will run even if has nothing to serve. Defaults to False, because the
|
2015-01-28 07:27:18 +01:00
|
|
|
daemon might require changing the port, if it is already taken.
|
2014-07-27 14:03:12 +02:00
|
|
|
* :ref:`supybot.servers.http.port`: The port the bot will bind. May not
|
|
|
|
work if the number is below 1024. Defaults to 8080 (alternative HTTP port).
|
|
|
|
|
2011-07-01 19:03:35 +02:00
|
|
|
|
|
|
|
Using the server
|
|
|
|
================
|
|
|
|
|
2015-01-27 15:39:08 +01:00
|
|
|
At the root of the server, you will find a list of the plugins that
|
|
|
|
have a Web interface, and a link to them. Each plugin has one or more
|
|
|
|
subdirectories of its own.
|
2011-07-01 19:03:35 +02:00
|
|
|
|
2015-01-27 15:39:08 +01:00
|
|
|
You may also want to run Apache httpd or Nginx in front of Supybot's HTTP
|
|
|
|
server, if you want to use subdomains or load balancing.
|
|
|
|
|
|
|
|
Here is an example of Apache httpd configuration (I didn't test it
|
|
|
|
with the rewrite, please notify me whether it works or not):
|
2011-07-01 19:03:35 +02:00
|
|
|
|
|
|
|
.. code-block:: apache
|
|
|
|
|
|
|
|
<VirtualHost 0.0.0.0:80>
|
|
|
|
ServerName stats.yourdomain.org
|
2014-07-27 14:03:12 +02:00
|
|
|
<Location />
|
2015-01-28 07:27:18 +01:00
|
|
|
ProxyPass http://localhost:8080/webstats/
|
2011-07-01 19:03:35 +02:00
|
|
|
SetEnv force-proxy-request-1.0 1
|
|
|
|
SetEnv proxy-nokeepalive 1
|
|
|
|
RewriteEngine On
|
|
|
|
RewriteRule ^/webstats/(.*)$ /$1
|
|
|
|
</Location>
|
|
|
|
</VirtualHost>
|
2014-01-20 10:32:00 +01:00
|
|
|
|
2015-01-27 15:39:08 +01:00
|
|
|
Here is an example of the Nginx configuration. Create a new site ``/etc/nginx/sites-enabled/bot``:
|
2014-10-15 08:13:25 +02:00
|
|
|
|
|
|
|
.. code-block:: nginx
|
|
|
|
|
|
|
|
server {
|
2014-11-15 20:39:39 +01:00
|
|
|
# Note that your default server should specify these ports
|
2014-10-15 08:13:25 +02:00
|
|
|
listen 80;
|
|
|
|
listen [::]:80;
|
2015-01-28 07:27:18 +01:00
|
|
|
# If your default server also has HTTPS configured, uncomment
|
2014-11-15 20:39:39 +01:00
|
|
|
# the following two listen lines to enable it for this vhost.
|
|
|
|
#listen 443;
|
|
|
|
#listen [::]:443;
|
2014-10-15 08:13:25 +02:00
|
|
|
server_name stats.yourdomain.org;
|
|
|
|
|
|
|
|
location / {
|
2015-01-28 07:27:18 +01:00
|
|
|
proxy_pass http://localhost:8080/;
|
2014-10-15 08:13:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-27 15:39:08 +01:00
|
|
|
Note that any HTTP server which can provide a reverse proxy service
|
|
|
|
can be configured to act as an intermediary or front end for the
|
|
|
|
Limnoria HTTP server. Configuring these alternatives is left as an
|
|
|
|
exercise to the system administrator (who ought to be familiar enough
|
|
|
|
with it already).
|
|
|
|
|
|
|
|
|
2014-01-20 10:32:00 +01:00
|
|
|
Templates
|
|
|
|
=========
|
|
|
|
|
2015-01-28 07:27:18 +01:00
|
|
|
Among the plugins which use the HTTP server, some use the standard templates
|
2014-01-20 10:32:00 +01:00
|
|
|
system which allows you to edit page templates in a standard way (for other
|
|
|
|
plugins, check their documentation).
|
|
|
|
|
|
|
|
Templates are located in the `data/web/` folder. There is a folder per plugin
|
|
|
|
(and a `generic` folder, which holds generic pages), and all file names end
|
|
|
|
with `.example`, which is the default template provided by the plugin.
|
|
|
|
To customize it, rename it to remove `.example` (for instance:
|
|
|
|
``mv fooplugin/foopage.html.example fooplugin/foopage.html``) and edit it
|
|
|
|
(either do it intuitively or check the plugin documentation to see how
|
|
|
|
it handles its templates).
|