Skip to content
Newer
Older
100644 102 lines (71 sloc) 3.46 KB
352eba0 Python packaging.
John Tobey authored
1 Apache 2 FastCGI setup on Debian/Ubuntu
2 =======================================
3
761e14c Python packaging fixes.
John Tobey authored
4 This document describes how to install and run Abe as a FastCGI
5 process under Apache 2 on a Debian GNU/Linux or Ubuntu system.
6 Advantages of FastCGI over the built-in HTTP server include:
7
8 * lets browsers cache static content for better performance;
9 * can integrate with an existing website, no :2750 in URLs.
10
11 These instructions assume root privileges. To begin a privileged
12 session in a terminal window, issue "sudo -i" (Ubuntu) or "su -"
13 (Debian).
14
352eba0 Python packaging.
John Tobey authored
15 Install required packages:
16
17 apt-get install apache2 libapache2-mod-fcgid python-flup
18 apt-get install python-crypto
19
761e14c Python packaging fixes.
John Tobey authored
20 Change directory to the Abe distribution and install Abe:
21
22 cd bitcoin-abe
23 python setup.py install
24
352eba0 Python packaging.
John Tobey authored
25 Replace YOUR.ABE.DOMAIN below with a domain that resolves to this
26 host. The site will be http://YOUR.ABE.DOMAIN/. To embed Abe in an
b947e47 Document the need to merge robots.txt when embedding in a site.
John Tobey authored
27 existing site (e.g., http://YOUR.DOMAIN/abe/) prepend a path (e.g.,
28 "/abe") in the Alias directives, place them in your existing
29 sites-available file instead of a new VirtualHost, and merge or create
0604586 Fixes.
John Tobey authored
30 your site's /robots.txt with adjusted paths from Abe/htdocs/robots.txt.
761e14c Python packaging fixes.
John Tobey authored
31
32 Replace HTDOCS/DIRECTORY below with the directory containing abe.css;
33 the Apache process must have permission to read it. The following
34 command displays the correct value:
35
36 python -m Abe.abe --print-htdocs-directory
37
38 Optionally, replace "/usr/lib/cgi-bin" below with another directory;
352eba0 Python packaging.
John Tobey authored
39 Apache must have the directory configured with Options +ExecCGI.
40
41 Create file /etc/apache2/sites-available/abe with these contents:
42
9f9caef Use <VirtualHost *:80> instead of <VirtualHost *>.
John Tobey authored
43 <VirtualHost *:80>
352eba0 Python packaging.
John Tobey authored
44 ServerName YOUR.ABE.DOMAIN
0604586 Fixes.
John Tobey authored
45 Alias /static/ HTDOCS/DIRECTORY/
71df520 Added robots.txt to prevent Google downloading the db.
John Tobey authored
46 Alias /robots.txt HTDOCS/DIRECTORY/robots.txt
47 Alias /favicon.ico HTDOCS/DIRECTORY/favicon.ico
352eba0 Python packaging.
John Tobey authored
48 Alias / /usr/lib/cgi-bin/abe.fcgi/
49
50 # Raise this if you get server errors mentioning "mod_fcgid:
51 # read data timeout in 40 seconds"
52 #FcgidIOTimeout 40
53
54 # Uncomment to log Abe requests.
55 #ErrorLog /var/log/abe_error.log
56 #LogLevel info
57 #CustomLog /var/log/abe_access.log combined
58 </VirtualHost>
59
60 Enable the new configuration:
61
62 a2ensite abe
0604586 Fixes.
John Tobey authored
63 service apache2 reload
352eba0 Python packaging.
John Tobey authored
64
65 Replace USER with your Unix user name and create file
66 /usr/lib/cgi-bin/abe.fcgi with these contents:
67
68 #! /usr/bin/python
69 import subprocess, sys, os
70 command=["sudo", "-u", "USER", "/home/USER/cgi-bin/abe", str(os.getpid())]
71 subprocess.Popen(command, stdin=sys.stdin).wait()
72
73 Make the file executable:
74
75 chmod +x /usr/lib/cgi-bin/abe.fcgi
76
77 Replace USER with your Unix user name and use visudo(1) to append
78 the following to /etc/sudoers:
79
80 # This allows the Apache account (www-data) to run Abe as USER.
81 www-data ALL=(USER) NOPASSWD: /home/USER/cgi-bin/abe
82
83 Put configuration such as database connection parameters in
84 /home/USER/abe.conf or change the location below. See the sample
85 abe.conf in the Abe distribution for file format. IMPORTANT: Make
86 sure the configuration does NOT contain a "host" or "port" option.
87
761e14c Python packaging fixes.
John Tobey authored
88 Create file /home/USER/cgi-bin/abe with these contents:
352eba0 Python packaging.
John Tobey authored
89
90 #! /bin/sh
761e14c Python packaging fixes.
John Tobey authored
91 PYTHONUNBUFFERED=1 exec python -m Abe.abe \
352eba0 Python packaging.
John Tobey authored
92 --config /home/USER/abe.conf --static-path static/ --watch-pid="$1"
93
94 Make the file executable:
95
96 chmod +x /home/USER/cgi-bin/abe
97
761e14c Python packaging fixes.
John Tobey authored
98 Abe should be reachable at http://YOUR.ABE.DOMAIN/. Exit the
99 privileged session:
100
101 exit
Something went wrong with that request. Please try again.