Use Apache2 as WebserverΒΆ

  • Bots uses cherrypy webserver Out of the Box and in order to scale it, you need to run it on an Apache2 Web Server
  • One Advantage is that with this is that apache2 will take care of staring the Bots Monitor so there is no need to create a daemon for the bots webserver.


  1. Ensure that apache2 is installed and running on the system. (try httpd -M)

  2. The mod_wsgi package is needed for this set up, so install it and add the line LoadModule wsgi_module modules/ to apache httpd.conf file.

  3. Restart the apache server, run the command httpd -M and you should see the wsgi_module at the end.

  4. Now we need to shuffle a few directories, create a base directory called bots_app in your home folder (do not run under root)

  5. Move the folders botssys, usersys, media and config from the bots installation directory to bots_app folder.

  6. Do not forget to create sym links for these folders in the installation dir to this new location.

  7. Now add the following files to the bots_app folder:

    import sys
    import django.core.handlers.wsgi
    import mod_wsgi
    #set PYTHONPATH...not needed if bots is already on PYTHONPATH
    from bots import apachewebserver
    config = mod_wsgi.process_group
    application = django.core.handlers.wsgi.WSGIHandler()
    Listen {PORT}
    NameVirtualHost \*:{PORT}
    ## Use this if you run into socket errors on linux
    WSGISocketPrefix /var/run/wsgi
    <VirtualHost \*:{PORT}>
       WSGIScriptAlias /{PATH TO UR HOME}/bots_app/bots.wsgi
       WSGIDaemonProcess config user={System User} group={System User Group}
       WSGIProcessGroup config
    ## Use this section only when enabling https for bots app
       SSLEngine on
       SSLCertificateFile /path/to/
       SSLCertificateKeyFile /path/to/
       Alias /media {PATH TO UR HOME}/bots_app/media
       <Directory {PATH TO UR HOME}/bots_app/>
            Order deny,allow
            Allow from all
       <Directory {PATH TO UR HOME}/bots_app/media>
            Order deny,allow
            Allow from all
  8. Add execute permission to the bots.wsgi file and add the line Include {PATH TO UR HOME}/bots_app/apache2.conf at the end of the apache2 httpd.conf file.

  9. Restart apache server and open http://{ip}:{port}/, you should see the bots welcome screen. If you get permission errors or images are not loading then correct permissions need to be given to bots_app and its parent directory.

  10. Once the server is running the logs will be generated in the folder botssys/logging as apache_webserver_config.log

  11. The script should not be used now as apache2 will automatically start up the application.

  12. Add botsengine_path = /usr/local/bin/ in the Bots ini file.