Ticket #20562: expand-install.patch

File expand-install.patch, 3.8 KB (added by hiro, 3 years ago)

Add nginx config

  • INSTALL.md

    From 61794c86268d0922e3ef00ca1b5f1fc87517d086 Mon Sep 17 00:00:00 2001
    From: hiromipaw <silvia@nopressure.co.uk>
    Date: Thu, 3 Nov 2016 18:20:03 +0100
    Subject: [PATCH] Edit INSTALL.md and add nginx config
    
    ---
     INSTALL.md                      | 23 ++++++++++++++++++-----
     src/main/webapp/nginx-collector | 32 ++++++++++++++++++++++++++++++++
     2 files changed, 50 insertions(+), 5 deletions(-)
     create mode 100644 src/main/webapp/nginx-collector
    
    diff --git a/INSTALL.md b/INSTALL.md
    index 4b0b143..bf7df4b 100644
    a b of other operating systems, those might work, too, but, again, you'll be on your 
    4343own.
    4444
    4545CollecTor does not require installing many or specific dependencies on the host
    46 system.  All it needs are a Java Runtime Environment version 7 or higher and an
    47 Apache HTTP Server version 2 or higher.
     46system.  All it needs are a Java Runtime Environment version 7 or higher and
     47either Apache HTTP Server version 2 or higher, or Nginx 0.8 or higher.
    4848
    4949The CollecTor service runs entirely under a non-privileged user account.  Any
    5050user account will do, but feel free to create a new user account just for the
    The option `-Xmx2g` sets the maximum heap space to 2G, which is based on the 
    122122recommended 4G total RAM size for the host.  If you have more memory to spare,
    123123feel free to adapt this option as needed.
    124124
     125There is no option to limit the amount of disk space used.
     126
    125127This may take a while, depending on which modules you activated.  Read the logs
    126128to learn if the run was successful.  If it wasn't, go back to editing the
    127129properties file and re-run the .jar file.  Change the run-once option back when
    tarball to the working directory or another location of your choice, editing the 
    133135contained paths, and executing it.  Note that this script will at least partly
    134136fail if one or more modules are deactivated.
    135137
     138Note that if you haven't edited the contained paths, the script will write to:
     139`/srv/collector.torproject.org/collector`.
     140
    136141
    137142### Scheduling periodic runs
    138143
    refer to settings in `collector.properties`): 
    162167 * `<IndexPath>`, and
    163168 * `<RecentPath>`.
    164169
    165 Use your browser to make sure that your instance serves the web pages and data
    166 that you'd expect.
     170You can also configure Nginx as the web server of your choice. If you use
     171Nginx you will need to use FancyIndex module to be able to include the provided
     172footer and header of the webapp.
     173
     174Copy `collector-<version>/src/main/webapp/nginx-collector` to
     175`/etc/nginx/sites-available/` and make a symbolic link in
     176`/etc/nginx/sites-enabled/` to enable it.
     177
     178
     179Now, use your browser to make sure that your instance serves the web pages and
     180data that you'd expect.
    167181
    168182
    169183## Maintaining the service
    usually harmless and can be ignored. 
    278292
    279293But let's hope that you won't run into any of these issues or at least not
    280294frequently.  Enjoy your new CollecTor instance!
    281 
  • new file src/main/webapp/nginx-collector

    diff --git a/src/main/webapp/nginx-collector b/src/main/webapp/nginx-collector
    new file mode 100644
    index 0000000..329d019
    - +  
     1##
     2# The following is a simple Nginx configuration to run CollecTor.
     3##
     4server {
     5
     6  # We assume the you have copied the content of webapp to
     7  # /var/www/collector/html
     8
     9  root /var/www/collector/html;
     10
     11  # This option make sure that Nginx will follow symlinks to the appropriate
     12  # CollecTor folders
     13  autoindex on;
     14
     15  index index.html;
     16
     17  # You can change the specified servername. If you leave it as it is you will
     18  # need to add an entry on /etc/hosts for collector
     19  server_name collector;
     20
     21  location / {
     22    fancyindex on;
     23    fancyindex_exact_size off;
     24    fancyindex_header /header.html;
     25    fancyindex_footer /footer.html;
     26    try_files $uri $uri/ =404;
     27  }
     28
     29  location ~/\.ht {
     30    deny all;
     31  }
     32}