Web Faction Software Documentation
Web Faction Software Documentation
CONTENTS
.
.
.
.
.
.
3
3
4
6
7
9
10
13
14
Bazaar
3.1 Installing Bazaar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2 Publishing Bazaar Repositories with Loggerhead . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
17
17
Custom Applications
4.1 Creating a Custom Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2 Automatically Restarting a Custom Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21
21
21
Django
5.1 Getting Started with Django . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2 Configuring Django . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.3 Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
23
28
35
Drupal
6.1 Backing Up Drupal . . . . . . . .
6.2 Updating Drupal . . . . . . . . .
6.3 Configuring Clean URLs . . . . .
6.4 Serving Uploads Faster . . . . . .
6.5 Speeding Up Drupal with Caching
6.6 Sending Email from Drupal . . .
6.7 Troubleshooting . . . . . . . . .
General Topics
1.1 Accessing Logs . . . . . . .
1.2 Monitoring Memory Usage
1.3 Reducing Memory Usage .
1.4 Setting File Permissions . .
1.5 Scheduling Tasks with Cron
1.6 Troubleshooting . . . . . .
Git
7.1
7.2
7.3
7.4
7.5
7.6
7.7
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
45
45
45
46
47
47
48
48
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
49
49
50
50
51
51
52
52
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
7.8
Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
52
Joomla
8.1 Upgrade Joomla . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.2 Sending Email . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
55
55
55
Memcached
9.1 Setting Up Memcached . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2 Using Memcached with an Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.3 Shutting Down Memcached . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
57
57
57
57
10 Mercurial
10.1 Installing Mercurial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2 Publishing Mercurial Repositories to the Web . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.3 Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
59
59
59
64
11 mod_wsgi
11.1 Reducing Application Start-Up Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.2 Reducing mod_wsgi Memory Consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.3 Using a virtual environment with mod_wsgi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
65
65
65
66
12 MongoDB
12.1 Installing MongoDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
69
69
13 Movable Type
13.1 Configuring Movable Type to Send Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13.2 Configuring Movable Type to Send Email with SMTP . . . . . . . . . . . . . . . . . . . . . . . . .
71
71
72
14 Node.js
14.1 Starting and Stopping Node.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.2 Installing Packages with npm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.3 Upgrading Node.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
75
75
75
76
15 Perl
15.1
15.2
15.3
15.4
15.5
Installing cpanminus . . . . . . . . . . . . . . . . . .
Installing a Perl Module with cpanm . . . . . . . . .
Using Local Perl Modules in a Command-Line Script
Using Local Perl Modules in a CGI Script . . . . . . .
Using Alternate Perl Versions with Perlbrew . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
77
77
77
77
78
78
16 PHP
16.1
16.2
16.3
16.4
16.5
16.6
16.7
16.8
16.9
16.10
16.11
16.12
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
81
81
81
82
82
83
84
84
85
86
87
87
87
89
89
ii
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
92
95
18 Pyramid
99
18.1 Deploying an Existing Pyramid Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
18.2 Serving Pyramid with a URL Prefix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
18.3 Starting, Stopping, and Restarting Pyramid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
19 Python
19.1 Python Search Path . . . .
19.2 Creating a python Alias
19.3 Installing Python Packages
19.4 Troubleshooting . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
103
103
103
104
106
20 Ruby
111
20.1 Installing Gems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
21 Ruby on Rails
21.1 Installing Ruby on Rails . . . . . . . . . . . . . . . . .
21.2 Upgrading RubyGems . . . . . . . . . . . . . . . . . .
21.3 Installing Gems . . . . . . . . . . . . . . . . . . . . . .
21.4 Installing Multiple Gems with Bundler . . . . . . . . .
21.5 Installing ImageMagick and RMagick . . . . . . . . . .
21.6 Installing sqlite3-ruby . . . . . . . . . . . . . . . . . .
21.7 Deploying a Ruby on Rails Application . . . . . . . . .
21.8 Deploying a Ruby on Rails Application with Capistrano
21.9 Upgrading Ruby on Rails . . . . . . . . . . . . . . . .
21.10 Using a Database with a Ruby on Rails Application . .
21.11 Configuring Action Mailer . . . . . . . . . . . . . . . .
21.12 Troubleshooting . . . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
113
113
114
114
115
115
116
117
117
118
119
120
121
22 Redmine
123
22.1 Configuring Redmine to Send Email . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
23 SQLite
125
23.1 Installing SQLite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
23.2 Installing SQLite from Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
24 Static Files, CGI Scripts, and PHP Pages
127
24.1 Static-only . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
24.2 Static/CGI/PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
24.3 Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
25 Subversion
25.1 Send Email Notifications with a Post-Commit Hook . . . . . . .
25.2 Managing Users . . . . . . . . . . . . . . . . . . . . . . . . . .
25.3 Reusing Usernames and Passwords Between Subversion and Trac
25.4 Backing Up and Restoring Subversion Repositories . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
139
139
140
141
141
26 Trac
26.1
26.2
26.3
26.4
26.5
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
143
143
145
145
146
146
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
iii
26.6
26.7
26.8
26.9
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
147
147
148
148
27 WebDAV
151
27.1 Creating a WebDAV Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
27.2 Adding and Removing WebDAV Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
28 Webstats
155
28.1 AWStats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
28.2 Webalizer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
29 WordPress
29.1 Using WordPress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29.2 Advanced WordPress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29.3 Troubleshooting WordPress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
157
157
161
164
Index
167
iv
Contents:
CONTENTS
CONTENTS
CHAPTER
ONE
GENERAL TOPICS
Shared Apache error logs Logs of the filename form beginning error_website_name_php.log
record error events for all shared Apache-based applications reached through website_name . This
includes all shared Apache-based applications, such as Trac, Subversion, and Static/CGI/PHP applications.
Such logs record a date and time and an error message.
For example, suppose you have a Website entry with this configuration:
mysite
/ --> htdocs (Static/CGI/PHP)
/blog/ --> wp (WordPress)
/testing/ --> fancyapp (Django)
mysite s access logs are stored in files beginning with access_mysite.log , while mysite s error logs
are stored in files beginning with error_mysite.log . access_mysite_php.log records htdocs and
wp s errors but not fancyapp s errors. fancyapp s error logs are stored elsewhere; see User Logs for details.
RSS stands for resident set size. RSS is the physical memory used by the process in kilobytes. COMMAND is the
processs command along with any arguments used to start it.
The next four rows show a Rails application running with Passenger and nginx:
1640
7676
544
844
The PassengerNginxHelperServer and Passenger processes are the passenger component of the
application, which handle, for example, executing Ruby code. The two nginx processes are the web server
component of the application, which respond to the incoming HTTP requests. Altogether these processes are
consuming 10,704KB or slightly more than 10 megabytes (MB).
The next row is the ps process itself:
896 ps -u johndoe -o rss,command
Although there are three processes, this is one ordinary Django application. These are the Apache processes used to
respond to HTTP requests and to run Django itself. Together these processes are consuming 18,668KB or slightly
more than 18MB of memory.
Finally, the last two lines show us johndoes connection to the server:
1588 sshd: johndoe@pts/1
1472 -bash
These processes are the SSH service and the Bash prompt, which allow johndoe to interact with the server from afar.
They use relatively little memory, 3,060KB or under 3MB.
In total, johndoe is using less than 32MB of memory, which is well under the limit for his plan, so hes not at risk of
having his processes terminated and having to find ways to reduce his memory consumption.
If johndoes processes had exceeded his plan limits by a small amount, he would receive a warning message. If his
processes had exceeded his plan limits by a large amount, his processes would be terminated and he would receive a
notification.
Profile your memory consumption. There may be tools available which work with your programming
language to help you identify how memory is being consumed. For example, Guppy for Python features the
heapy memory inspection module and Xdebug is a popular profiler for PHP.
To use MAILTO on CentOS 6 servers ( web300 and greater or dweb89 and greater), you must set the
sender address. To set the sender address, on a new line before any jobs (for example, immediately after the
line containing MAILTO ), insert MAILFROM=sender , where sender is the sender address.
When using MAILTO on CentOS 5 servers (less than web300 or less than dweb89 ), the sender address is
username@server_name.webfaction.com , where username is your username and server_name is
the WebFaction server.
On all servers, you can redirect the output of a cron job to mail , which allows you to specify job-specific
subject lines, recipient addresses, and sender addresses. For example, this cron job runs once an hour and sends
all output of sample_command to a recipient with a custom subject line, recipient address, and sender
address:
Instead of email, you can store the output from a cron job by redirecting it to a log file. For example, this cron
job records cron is running every 20 minutes to ~/logs/user/cron.log :
*/20 * * * * echo "cron is running" >> $HOME/logs/user/cron.log 2>&1
See also:
Cron Help Guide from Linux Help
4. Save and close the file.
1.6 Troubleshooting
Unfortunately, things dont always work as planned. Here you will find troubleshooting hints for general errors and
problems sometimes seen among WebFaction users.
10
1.6. Troubleshooting
11
12
CHAPTER
TWO
Many software packages can be installed to your home directory by building the software from source. To build
software from source and install it to your home directory:
Note: On CentOS 5 servers (servers less than web300 ), some software may be difficult or impossible to install
because system libraries such as glibc are too old. In such cases, consider migrating to a CentOS 7 server.
1. Open an SSH session to your account.
2. Create a temporary directory. Some software installations may require a user-writable temporary directory. To
create the directory, enter mkdir -p $HOME/tmp and press Enter .
3. Set the TEMPDIR environment variable to point to the temporary directory. Enter
export TEMPDIR=$HOME/tmp and press Enter .
4. Download the source to your home directory.
Typically, source is distributed in a zip or tar archive that contains the software packages source files,
configuration scripts, and documentation. To download this file directly to your home directory with wget:
enter wget url , where url is the URL for the source archive, and press Enter . The source archive is
created in the current directory.
5. Unpack the source archive.
To unpack a zip file, enter unzip file , where file is the path to the source archive, and press Enter .
To unpack a tar file, enter tar -xf file , where file is the path to the source archive, and press Enter .
The new directory containing the source files is created in the current directory.
6. Switch to the source directory. Enter cd source , where source is the path to the directory containing the
source files, and press Enter .
7. Read the softwares documentation. Some software packages may require additional installation steps or
configuration switches. Review the packages README and INSTALL files, if available.
8. Run the packages configure script. The script prepares the build environment for the package; typically,
switches on this script determine where to install the software and where to find relevant dependencies. The
most frequently used switches include:
--prefix= This switch determines where the software will be installed, including shared libraries and
executables. You will use --prefix=$HOME to choose your home directory as the installation
destination.
--with-curl= If applicable, this switch notifies the software where to find the cURL executable. You can
use --with-curl=/usr to specify the systems cURL executable. Alternatively, you can use
13
--with-curl=$HOME to specify a different version of cURL that you may have installed in your
home directory.
--with-wget= If applicable, this switch notifies the software where to find the wget executable. You can
use --with-wget=/usr to specify the systems wget executable. Alternatively, you can use
--with-wget=$HOME to specify a different version of wget that you may have installed in your
home directory.
To see all of the available options, enter ./configure --help and press Enter .
To run the configure script, enter ./configure --prefix=$HOME switches , where switches are
any additional, space-separated switches the software requires, and press Enter .
9. Build the binaries from the source: enter make and press Enter . The build runs.
Note: This step may take a few minutes to complete.
10. Install the software. Enter make install . The completed software is copied to appropriate locations, such
as executables in ~/bin and libraries in ~/lib .
2.1 Troubleshooting
2.1.1 Depending on Non-Standard Libraries and Headers Causes Errors
Some software packages may depend on non-standard libraries or headers. If these dependencies are not available,
then you may encounter an error such as
cannot open shared object file: No such file or directory or various other errors while
running the softwares configure script. These problems can be resolved with the help of some environment
variables: CPPFLAGS , LDFLAGS , and LD_LIBRARY_PATH .
See also:
Dont forget to set appropriate configure switches, too. See the Installing Software from Source step-by-step
instructions for details.
CPPFLAGS is used to support non-standard headers. For installations which require additional headers, you may
add your home directorys include directory to CPPFLAGS . Before running configure or make , enter
export CPPFLAGS="-I$HOME/include $CPPFLAGS" and press Enter .
LDFLAGS is used to support non-standard libraries. For installations and executions which require additional
libraries, you may add your home directorys lib directory to LDFLAGS . Before running configure or
make , enter export LDFLAGS="-L$HOME/lib $LDFLAGS" and press Enter .
Like LDFLAGS , LD_LIBRARY_PATH is used to support non-standard libraries. For installations and executions
which require additional libraries, you may add your home directorys lib directory to LD_LIBRARY_PATH .
Before running configure , make , or the software after it is installed, enter
export LD_LIBRARY_PATH=$HOME/lib:$LD_LIBRARY_PATH and press Enter .
To simplify future usage, permanently amend your LD_LIBRARY_PATH by adding the export statement to your
$HOME/.bash_profile file. To permanently add $HOME/lib to your LD_LIBRARY_PATH , enter
echo "export LD_LIBRARY_PATH=$HOME/lib:$LD_LIBRARY_PATH" >> $HOME/.bash_profile
and press Enter .
14
Finally, for commands which run outside of your shell process, like an Apache server for a Django application or a
cron script, you may need to make additions to LD_LIBRARY_PATH elsewhere.
For example, a Django applications start script already defines the LD_LIBRARY_PATH environment variable. To
add $HOME/lib to the applications LD_LIBRARY_PATH , edit
$HOME/webapps/app/apache2/bin/start from this:
LD_LIBRARY_PATH=/home/<username>/webapps/<app>/apache2/lib /home/<username>/webapps/<app>/apache2/bin
to this:
LD_LIBRARY_PATH=/home/<username>/lib:/home/<username>/webapps/<app>/apache2/lib /home/<username>/weba
where <username> is your username and <app> is the name of the application.
Likewise, to change a cron jobs LD_LIBRARY_PATH , prepend LD_LIBRARY_PATH=$HOME/lib to your
cron jobs command. For example, edit this cron task:
1 0 * * * command
to this:
1 0 * * * LD_LIBRARY_PATH=/home/username/lib command
where username is your username and command is the task to be executed.
2.1. Troubleshooting
15
16
CHAPTER
THREE
BAZAAR
17
6. If applicable, in the IP address menu, click to select the IP address to serve the site.
7. If you want your site served over an HTTPS connection, click to select Encrypted website (https).
8. For each domain name you want to use with the website, add it to the list of domains. In the Domains field,
enter the domain name. Enter one or more domain names. If the domain has not yet been added to the control
panel, click the Create link that appears at the bottom of the list of domains to add it.
Note: Dont forget to point new domains to the WebFaction name servers.
9. Add an application for Loggerhead.
(a) Click Add an application Create a new application. The Create a new web app form appears.
(b) In the Name field, enter a name for the application.
(c) In the App category menu, click to select Custom.
(d) In the App type menu, click to select Custom app (listening on port).
(e) Click the Save button. The application is installed and added to websites list of applications.
10. Click the Add website button. The website is created and added to the list of websites.
11. Make a note of the port number for the Loggerhead application. This number is required later in the installation
process. Click Domains / websites Applications. The list of applications appears. The applications port
number appears next to the applications type.
18
Chapter 3. Bazaar
wget http://launchpad.net/loggerhead/1.17/1.17/+download/loggerhead-1.17.tar.gz
and press Enter . An archive is created in the current directory.
3. Decompress the Loggerhead archive. Enter tar -zxvf loggerhead-version_number.tar.gz
and press Enter . A directory called loggerhead is created.
4. Switch to the loggerhead directory. Enter cd loggerhead and press Enter .
5. Open serve-branches in a text editor.
6. Edit the first line of the file from this:
#!/usr/bin/env python
to this:
#!/usr/bin/env python2.5
where
<username> is your username,
<custom_app_name> is the name of your Custom app,
<number> is the port number assigned to your Custom app,
and <bzr_directory> is the full path to the directory you created to store repositories (for example,
/home/username/bzr ).
4. Save and close the file.
Every twenty minutes your Loggerhead installation is automatically restarted. Once the Loggerhead process starts,
access your repositories on the web at the domain and path you specified previously.
19
20
Chapter 3. Bazaar
CHAPTER
FOUR
CUSTOM APPLICATIONS
If there is software you want to run which does not have a provided one-click installer but can respond to HTTP
requests by listening to a specific port, you can use a Custom app (listening on port) application.
21
Since you probably wont be watching the application constantly, its advisable to set up a cron job which will
automatically restart your application if it is no longer running.
While some applications may gracefully restart by running the same command used to launch the program in the first
place, others may have unexpected or unpleasant side-effects, such as starting numerous copies of the same program,
quickly consuming your memory allotment. For such applications, we recommend wrapping your command in a
script which verifies the application is not already running beforehand.
22
CHAPTER
FIVE
DJANGO
Django is an open source Python web development framework. You can learn more about Django and see the official
documentation at the Django website.
(a) Click Add an application Create a new application. The Create a new web app form appears.
(b) In the Name field, enter a name for the Django application.
(c) In the App category menu, click to select Django.
(d) Click the Save button. The Django application is installed and added to websites list of applications.
9. Create the static media application.
(a) Click Add an application Create a new application. The Create a new web app form appears.
(b) In the Name field, enter a name for the static media application.
(c) In the App category menu, click to select Static.
(d) In the App type menu, click to select Static only (no .htaccess).
(e) In the URL field, enter static .
(f) Click the Save button. The static media application is installed and added to the websites list of
applications.
10. Click the Save button. The website is created and added to the list of websites.
24
Chapter 5. Django
where
<django_app> is the name of Django application,
<username> is your username,
<python> is the Python version associated with the application (for example, python2.7 ), and
<project> is the name of your Django project.
7. Change
WSGIScriptAlias / /home/username/webapps/django_app/myproject/myproject/wsgi.py
to
WSGIScriptAlias / /home/username/webapps/django_app/project/project/wsgi.py .
8. Save your changes and close the file.
Be sure to update your Django settings to use your new database and media applications.
1. Open an SSH session to your account.
2. In a text editor, open
/home/username/webapps/django_app/project/project/settings.py , where
django_app is the name of the application as it appears on the control panel and project is the name of Django
project ( myproject , by default).
3. Set ALLOWED_HOSTS to a list of hostnames where your Django site is expected to run. For example, if you
site is being served at example.com and www.example.com , then your ALLOWED_HOSTS setting
should look like this:
ALLOWED_HOSTS = [
'example.com',
'www.example.com',
]
Alternatively, you can specify a subdomain wild card with a leading period. For example, to permit any
subdomain of example.com , then ALLOWED_HOSTS would look like this:
25
ALLOWED_HOSTS = [
'.example.com',
]
As a security precaution, this setting is required for your Django site to run with DEBUG = False .
Configuring Django to Connect to a Database
While continuing to edit
/home/username/webapps/django_app/project/project/settings.py :
1. Update the DATABASES default dictionary:
(a) Set ENGINE to django.db.backends.postgresql_psycopg2 .
(b) Set NAME to a string containing the database name you specified in Creating a Database.
(c) Set USER to a string containing the database username you specified in Creating a Database.
(d) Set PASSWORD to a string containing the database users password.
(e) Set HOST to 127.0.0.1 .
(f) Set PORT to 5432 .
When youre finished, your DATABASES settings will look something like this:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'django_db',
'USER': 'django_db',
'PASSWORD': 'mysecret',
'HOST': '127.0.0.1',
'PORT': '5432',
}
}
2. Configure Django to collect static media in your static media applications directory.
26
Chapter 5. Django
27
(d) Set STATIC_URL to http://domain/static/ where domain is the domain name for your
Django site.
(e) Set STATIC_ROOT to /home/username/webapps/static_media_app/ where
static_media_app is the name of the static media application.
(f) Save and close the file.
4. Collect the static media into the static media application.
(a) Open an SSH session to your account.
(b) Switch to the Django project directory. Enter
cd /home/username/webapps/django_app/project/ and press Enter .
28
Chapter 5. Django
(c) Enter pythonX.Y manage.py collectstatic , where X.Y is the version of Python for your
Django application, and press Enter . The static files are copied to your static media application.
5. Restart the Django application.
Alternatively, you can specify a subdomain wild card with a leading period. For example, to permit any
subdomain of mysite.example , then the ALLOWED_HOSTS setting would look like this:
ALLOWED_HOSTS = [
'.mysite.example',
]
See also:
See the official Django documentation for ALLOWED_HOSTS.
3. Save and close the file.
4. Restart the Django application.
Django now responds to requests for the specified domains. Requests for other domains raise a
SuspiciousOperation exception.
29
where <MEMCACHED_SOCKET> is the path to your memcached socket file (for example,
/home/username/memcached.sock ).
5. Save and close the file.
6. Restart the Django application.
where
<mailbox> is the name of a WebFaction mailbox as it appears on the control panel,
<password> is the mailbox password, and
<address> are email addresses configured on the WebFaction control panel.
4. Save and close the file.
5. Restart the Django application.
30
Chapter 5. Django
For more information about time zone configuration, including valid time zone names and alternative configurations,
see TIME_ZONE in the Django project documentation.
authn_core_module
auth_basic_module
authn_file_module
authz_user_module
modules/mod_authn_core.so
modules/mod_auth_basic.so
modules/mod_authn_file.so
modules/mod_authz_user.so
31
where <username> is the account name and <django_app> is the name of the Django
application as it appears in the control panel.
You may also change the string following AuthName with the text of your choice or change the path in
<Location "/"> to a more specific subpath (for example, <Location "/private"> ).
(d) Save and close the file.
3. Restart the Django application.
The Django application (or specified subpath) is now password protected. If needed, you may create and update
usernames and passwords. From the application directory, enter htpasswd htpasswd username , where
username is a new or existing username, and press Enter . A series of prompts appear to enter and confirm the
password.
32
Chapter 5. Django
with these:
DATABASES = {
'default': {
'ENGINE': '<engine>',
'NAME': '<db_name>',
'USER': '<db_user>',
'PASSWORD': '<db_password>',
'HOST': '',
'PORT': '',
}
}
where:
<engine> is django.db.backends.postgresql_psycopg2 for PostgreSQL
databases, django.db.backends.mysql for MySQL databases, or
django.db.backends.sqlite3 for SQLite version 3 databases,
<db_name> is the path to the SQLite database file or the name of the MySQL or PostgreSQL
database,
<db_user> is blank for SQLite databases or a username with permission to access the database,
and
<db_password> is blank for SQLite databases or the password for the database user.
Note: If youre using a MySQL database, then your databases storage engine may limit some Django
features. By default, MySQL uses the MyISAM storage engine, which does not provide transaction
support. If you intend to use Djangos transactions with a MySQL database, then choose the InnoDB
storage engine before you create your tables for the first time (in other words, before you run the
migrate management command).
To use the InnoDB storage engine, add the OPTIONS key to your database configuration:
'OPTIONS': {
'init_command': 'SET storage_engine=INNODB',
}
33
'HOST': '',
'PORT': '',
'OPTIONS': {
'init_command': 'SET storage_engine=INNODB',
},
}
}
For more information, see the Django documentation for storage engines.
(d) Save and close the file.
3. Synchronize the database.
(a) Switch to the Django project directory. Enter cd $HOME/webapps/django_app/project/ ,
where project is the name of the project directory, and press Enter .
(b) Enter pythonX.Y manage.py migrate , where X.Y is your Django applications version of
Python and press Enter .
4. Restart the Django application.
34
Chapter 5. Django
11. Delete your old Django libraries. Enter rm -rf lib/pythonA.B/django.old and press Enter .
Note: This will not change the Django version number shown in the control panel. The control panel only records
originally installed version numbers.
5.3 Troubleshooting
5.3.1 General Django Troubleshooting Techniques
While some specific Django problems are addressed in this guide, some problems may require additional
investigation to resolve. Here are some common strategies for resolving problems with Django applications.
Reviewing Django Logs in Real Time
You can review the logs of a Django application as they are recorded using tail with the log file. To review the logs in
real time:
1. Open an SSH session to your account.
2. Switch to the user logs directory. Enter cd $HOME/logs/user and press Enter .
3. Enter tail -f error_django_app.log , where django_app is the name of the Django application as
it appears in the control panel and press Enter .
5.3. Troubleshooting
35
New additions to the error log will automatically appear on screen. You can now access the site and see any log
entries as they appear.
See also:
Accessing Logs
Using the DEBUG Setting
Django has a built-in debug mode, provided by the DEBUG setting in your Django projects settings module.
When DEBUG is enabled and an exception is raised, a detailed debugging output (including a stack trace) is
rendered instead of attempting to render the 500 template.
See also:
Django Documentation > Settings > DEBUG
Warning: Do not leave DEBUG set to True during normal operation. In addition to showing users unnecessary and potentially compromising configuration details in error pages, the DEBUG setting also causes Django
to consume significantly more memory, which may exceed plan allotments.
To enable the Django DEBUG setting:
1. Open an SSH session.
2. Open settings.py for the Django application. Typically, this file is found in
$HOME/webapps/django_app/project/project .
3. If it already exists, edit the line containing DEBUG = False to DEBUG = True . Otherwise, add a new
line containing DEBUG = True to the file.
4. Restart the Django application.
Now, when an error occurs, a stack trace, settings information, and other valuable data is provided instead of
rendering an error page. To force the appearance of the Django debugging page, add an assert False to a view
and attempt to access it.
Using the Django Debug Toolbar
The Django Debug Toolbar is a pluggable Django app that adds debugging information (such as settings, headers,
and SQL queries.) to pages.
To install and configure the Django Debug Toolbar with the default myproject Django project:
1. Install the Django Debug Toolbar:
(a) Open an SSH session to your account.
(b) Switch to the Django applications directory. Enter cd $HOME/webapps/django_app , where
django_app is the name of the Django application as it appears on the control panel, and press Enter .
(c) Add the Django applications Python directory to PYTHONPATH . Enter
export PYTHONPATH=$PYTHONPATH:$PWD/lib/pythonX.Y/ , where X.Y is the version of
Python for the Django application (for example, Python 2.7 or Python 3.3), and press Enter .
36
Chapter 5. Django
to this:
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'debug_toolbar',
)
5.3. Troubleshooting
37
to this:
MIDDLEWARE_CLASSES = (
'myproject.middleware.WebFactionFixes',
'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
# ...
)
(e) Set which IP addresses can see the Django Debug Toolbar. One a new line, add
INTERNAL_IPS = (address,) , where address is your IP address or another address that
should have access to debugging information. To add multiple IP addresses, separate each by a comma
(for example,
INTERNAL_IPS = (203.0.113.0, 203.0.113.1, 203.0.113.2) ).
(f) Save and close the file.
(g) Open the Django projects URLs file,
~/webapps/django_app/myproject/myproject/urls.py , in a text editor.
(h) At the beginning of the file, insert these lines:
from django.conf import settings
from django.conf.urls import patterns
38
Chapter 5. Django
runserver is
intended as a development aid. runserver does not provide sufficient security, stability, and performance for
production use.
From the Django documentation regarding runserver:
DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone through security
audits or performance tests. (And thats how its gonna stay. Were in the business of making Web
frameworks, not Web servers, so improving this server to be able to handle a production environment
is outside the scope of Django.)
1. Create a custom application listening on a port.
(a) Log in to the control panel.
(b) Click Domains / websites Applications. The list of applications appears.
(c) Click the Add new application button. The Create a new application form appears.
(d) In the Name field, enter a name for the application.
(e) In the App category menu, click to select Custom.
(f) In the App type menu, click to select Custom app (listening on port).
(g) If applicable, in the Machine menu, click to select a web server.
(h) Click the Save button. The application is created and added to the list of applications.
(i) Make a note of the port number assigned to the application. It is required in a later step.
2. Create a website entry for the custom application.
3. Start the Django development server.
(a) Open an SSH session to your account.
(b) Switch to the directory of the Django project. Enter
cd $HOME/webapps/django_app/project , where django_app is the name of the Django
application as it appears in the WebFaction control panel and project is the name of the Django project,
and press Enter .
(c) Enter python manage.py runserver port , where port is the port number assigned to the
custom application, and press Enter .
You can now access the Django site with a web browser. The Django development server output will appear in the
SSH session.
Python will raise an ImportError exception whenever it cannot find a particular package or module named in an
import statement. This is typically caused by the named module not appearing in Pythons module search path. For
example, this error sometimes happens while attempting to run manage.py .
To correct the problem, the offending module needs to be added to the Python search path. In the case of Django
module errors, you must add $HOME/webapps/django_app/lib/python2.7 to the Python module search
5.3. Troubleshooting
39
path. To learn more about methods you can use to add to the Python search path, please see Fixing ImportError
Exceptions.
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [no address given] and inform them of the time the error occ
While the error is not described in detail on the page, the error log for the application will look something like this:
40
Chapter 5. Django
[Fri
[Fri
[Fri
[Fri
[Fri
[Fri
[Fri
[Fri
[Fri
[Fri
[Fri
[Fri
[Fri
[Fri
[Fri
Nov
Nov
Nov
Nov
Nov
Nov
Nov
Nov
Nov
Nov
Nov
Nov
Nov
Nov
Nov
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
14:04:35
14:04:35
14:04:35
14:04:35
14:04:35
14:04:35
14:04:35
14:04:35
14:04:35
14:04:35
14:04:35
14:04:35
14:04:35
14:04:35
14:04:35
2009]
2009]
2009]
2009]
2009]
2009]
2009]
2009]
2009]
2009]
2009]
2009]
2009]
2009]
2009]
[error]
[error]
[error]
[error]
[error]
[error]
[error]
[error]
[error]
[error]
[error]
[error]
[error]
[error]
[error]
[client
[client
[client
[client
[client
[client
[client
[client
[client
[client
[client
[client
[client
[client
[client
To resolve this problem, create a new template named 500.html in your templates directory. To see what
directories are currently configured as template directories:
1. Open an SSH session to your account.
2. Enter cd $HOME/webapps/django_app/project/project , where django_app is the name of
your Django application as it appears in the control panel and project is the name of your Django project, and
press Enter .
3. Enter python -c "import settings; print settings.TEMPLATE_DIRS" and press
Enter .
Then, in one of the template directories, create a new file named 500.html . Heres an example 500.html :
<html>
<head>
<title>Server Error</title>
</head>
<body>
<h1>Sorry!</h1>
<p>Sorry, the server has encountered an error.</p>
</body>
</html>
though its recommended that you add contact information to your server error page, so your users can reach you in
the event of a problem.
5.3. Troubleshooting
41
processes or maximum requestsmay have a negative impact on overall performance. You may want to experiment
with different combinations of configuration values to suit your memory and performance needs.
Set DEBUG to False: When Djangos DEBUG setting is set to True , SQL queries and other extra data are
kept in memory. See Using the DEBUG Setting for more details on what DEBUG does and how to change it.
Serve static media with a Static-only application: Serving site media, like style sheets, JavaScript, CSS files,
and Django admin media, with the Django application is an inefficient use of memory. Instead, let the
system-wide nginx-process serve static media with a static application.
Reduce the number of objects loaded into memory: Use the features of Djangos ORM to avoid loading
more objects than you need into memory.
For example, suppose you want to retrieve all the users from your database with the first name John. Instead of
fetching all user objects and sifting through for those you need, like this:
# Don't do this!
subset_of_users = []
for user in Users.objects.all():
if user.first_name == 'John':
subset_of_users.append(user)
try using Djangos QuerySet API to load only the objects you need:
subset_of_users = Users.objects.filter(first_name__exact='John')
Not only is the QuerySet version fewer lines code, but it uses less memory too.
See also:
Django documentation: Making queries
42
Chapter 5. Django
5.3. Troubleshooting
43
44
Chapter 5. Django
CHAPTER
SIX
DRUPAL
Drupal is an open source content management system which can be used to build blogs, portals, and other web sites.
WebFaction provides a control panel installer for Drupal.
See also:
Drupal is a PHP-based application. Please see PHP and Static Files, CGI Scripts, and PHP Pages for additional
documentation.
45
46
Chapter 6. Drupal
(i) Click the Save configuration button. The page reloads with a confirmation message.
The Drupal application will now use clean URLs.
47
6.7 Troubleshooting
6.7.1 Strange Characters on 404 Pages
See also:
PHP > Troubleshooting > Strange Characters in Output
48
Chapter 6. Drupal
CHAPTER
SEVEN
GIT
49
Git Command
git clone /home/username/webapps/app/repos/proj.git
git clone http://domain/URL_path/proj.git
git clone http://git_user@domain/URL_path/proj.git
where:
app is the name of the Git application as it appears on the WebFaction control panel,
proj is the name of the Git repository,
domain is the domain name where the Git application is available, as configured in a website record on the
WebFaction control panel (for example, git.example.com ),
URL_path is the URL path (or URL mount point) where the Git application is available, as configured in a
website record on the WebFaction control panel,
git_user is a valid user as configured in the Git applications .htpasswd file,
See also:
Managing Users
and username is your WebFaction username.
50
Chapter 7. Git
Finally, for most repositoriesespecially if you anticipate adding large files, numerous files, or making many
changes to your repository between pushes and pullsyou should change the postBuffer setting on your local
repository clone:
1. Switch to the local repository directory. Enter cd path , where path is the path to the repository, and press
Enter .
2. Enter git config http.postBuffer bytes , where bytes is the maximum number of bytes
permitted, and press Enter .
For example, to permit pushes up to 500 megabytes, enter
git config http.postBuffer 524288000 and press Enter .
51
3. Enter htpasswd .htpasswd user , where user is a new or existing username, and press Enter .
4. Complete the password prompts.
See also:
See Strengthening Passwords for important information about choosing passwords.
Then, disable SSL certificate verification for the repository to enable push and pull operations:
# switch to the repository directory
git config http.sslVerify false
7.8 Troubleshooting
7.8.1 Error: RPC failed; result=22, HTTP code = 411
If you attempt to push a large set of changes to a Git repository with HTTP or HTTPS, you may get an error message
such as error: RPC failed; result=22, HTTP code = 411 . This is caused by a Git configuration
52
Chapter 7. Git
default which limits certain HTTP operations to 1 megabyte. To override this limitation, update the postBuffer setting
on your cloned repository.
7.8. Troubleshooting
53
54
Chapter 7. Git
CHAPTER
EIGHT
JOOMLA
55
6. Click the Save button. A confirmation message appears at the top of the page.
56
Chapter 8. Joomla
CHAPTER
NINE
MEMCACHED
57
58
Chapter 9. Memcached
CHAPTER
TEN
MERCURIAL
Mercurial, commonly referred to as Hg (the symbol for the element Mercury), is an open source distributed version
control system.
See also:
Bazaar, Git
where name is your name and email is your email address as they will appear in commit messages made
from your Mercurial installation.
6. Save and close the file.
You can now use the command line tool hg with Mercurial repositories. Enter hg help and press Enter for a
complete list of commands. To learn more about using Mercurial, check out the official Quick Start guide and the
Mercurial book.
59
Note: These directions assume you already have Mercurial installed. If you have not already installed Mercurial,
please see Installing Mercurial.
60
to replace python with pythonX.Y , where X.Y is the version of Python you used to install Mercurial.
6. If you are using a version of Mercurial later than 1.5, edit this line:
config = "/path/to/repo/or/config"
to this:
config = "/home/<username>/webapps/<static_app>/hgweb.config"
where <username> is your username and <static_app> is the name of your Static/CGI/PHP
application.
7. Uncomment these lines:
#import sys
#sys.path.insert(0, "/path/to/python/lib")
and replace /path/to/python/lib with the path to the directory where you installed Mercurial.
Typically, this directory will be /home/username/lib/pythonX.Y , where username is your username
and X.Y is the version of Python you used to install Mercurial.
8. Save and close the file.
9. Open a new file named hgweb.config .
61
10. Configure the path to your repositories. Append the following lines:
[paths]
/ = /path/to/repositories/**
If the URL path for the application is not a root of a domain (for example, www.example.com/hg/ ),
append the following lines:
[web]
baseurl = urlpath
Note: If you will not be hosting your repositories from the root URL path, replace RewriteBase / with
RewriteBase /path/to/directory . For example, if you were to host your repositories at
http://www.example.com/hg you would substitute RewriteBase / with
RewriteBase /hg .
4. Save and close the file.
62
You can now visit the domain and path specified in the website entry to see your Mercurial repositories. The listing is
probably empty now, however. Create new repositories with hg init in your repository directory to populate the
list.
where <username> is your username and <static_app> is the name of the Static/CGI/PHP
application.
Note: Alternatively, you can use the following lines to prohibit all access except for authenticated users:
AuthType Basic
AuthName MyHgWebDir
AuthUserFile /home/<username>/webapps/<static_app>/.htpasswd
Require valid-user
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>
63
Note: Alternatively, you can replace * with a comma separated list of users authorized to push. Or, for more
finely grained control, you can add these lines on a repository-by-repository basis in the repositories
.hg/hgrc files.
11. Save and close the file.
You can now push to the repositories as an authenticated user.
10.3 Troubleshooting
10.3.1 Error: bash: hg: command not found
If youre cloning, pulling, or pushing from Mercurial repositories via ssh (for example,
hg clone ssh://[email protected]/path/to/repo ), you may encounter
an error, bash: hg: command not found, which appears when the remote session is unable to locate the hg script.
To fix this problem:
1. Open your local .hgrc file in a text editor. .hgrc is typically found in your home directory.
2. In the [ui] section, add a new line containing remotecmd = ~/bin/hg .
3. Save and close the file.
64
CHAPTER
ELEVEN
MOD_WSGI
mod_wsgi is an Apache HTTP Server module for running Python software thats compatible with the Web Server
Gateway Interface (PEP 333). A mod_wsgi application as created with the control panel provides an Apache HTTP
Server with the mod_wsgi module.
becomes:
65
Use the WSGIDaemonProcess directives processes setting conservatively: Start fewer processes
by setting a small value for the WSGIDaemonProcess directives process setting.
In ~/webapps/application/apache2/conf/httpd.conf , where application is the name of the
mod_wsgi-based application, edit this line:
where:
<app> is the name of the mod_wsgi-based application,
<num> is the number of allowed processes, and
<user> is your account name.
For example, two to five processes will be enough for a Django site that uses a separate application to serve
static media.
Use the WSGIDaemonProcess directives maximum-requests setting: If an application is not
releasing memory in a way thats beyond your control (for example, a library used by your application is
leaking memory), then configure mod_wsgi to serve fewer requests before stopping and replacing a child
process.
In ~/webapps/application/apache2/conf/httpd.conf , where application is the name of the
mod_wsgi-based application, edit this line:
where:
<app> is the name of the mod_wsgi-based application,
<num> is the maximum number of requests, and
<user> is your account name.
Reasonable values are typically between 100 and 1000 requests, though you may need to experiment to find an
appropriate setting for your application.
See also:
mod_wsgi Configuration Directives
python-path=/home/demo/webapps/mywsgiapp/lib/python3.5 with
python-home=/home/demo/webapps/mywsgiapp/venv/ .
4. Optionally, set additional Python path directories, such as the path to your Python project. In the
WSGIDaemonProcess directive, add python-path=path . You can add more than one
python-path , if needed.
5. Save and close the file.
6. Restart Apache. Enter $HOME/webapps/app/apache2/bin/restart and press Enter .
The mod_wsgi now uses your virtual environment.
67
68
CHAPTER
TWELVE
MONGODB
69
(e) Add an administrator user, which can be used to manage other users. Enter
db.createUser({user: "<username>", pwd: "<password>", roles: ["userAdminAnyDatab
where <username> is the new administrator username of your choice and <password> is the new
users password, and press Enter .
(f) Authenticate as the administrator user. Enter db.auth("username", "password") , where
username is the administrator username you chose in the previous step and password is the users
password, and press Enter . If authentication is successful, a 1 appears.
You can use this administrator user to manage other users and their permissions. See the MongoDB
documentations on adding users for more detail.
See also:
For more information about user authentication, see the MongoDB Security documentation.
(g) Close the database connection. Enter exit and press Enter . You may also end the SSH session.
The database is configured and ready. You may start and stop the database as needed.
70
CHAPTER
THIRTEEN
MOVABLE TYPE
where <address> is Movable Types outgoing email address. This address must be registered on the
WebFaction control panel.
71
72
73
74
CHAPTER
FOURTEEN
NODE.JS
Node.js (also known as Node) is a platform for developing and running applications with JavaScript. You can
install a Node.js application with the control panel.
Note: If you are working with a Node.js application during an SSH session, then you may find it easier to add the
applications bin directory to your PATH environment variable. Otherwise, you must use full paths to node ,
npm , and other executables for the application.
To add a Node.js applications bin directory to your PATH environment variable:
1. Switch to your Node.js applications directory. Enter cd $HOME/webapps/nodejs_app/ , where
nodejs_app is the name of your Node.js application as it appears on the control panel, and press Enter .
2. Add the applications bin directory to your PATH environment variable. Enter
export PATH=$PWD/bin/:$PATH and press Enter .
For the remainder of the SSH session, you can run your applications executables without entering a full path.
75
76
CHAPTER
FIFTEEN
PERL
77
78
79
80
CHAPTER
SIXTEEN
PHP
Several application types use or may use PHP, including Static/CGI/PHP applications, WordPress, and Drupal.
Default php
version
5.2
5.2
5.6
PHP
5.2
Yes
Yes
PHP
5.3
Yes
Yes
PHP
5.4
Yes
Yes
Yes
PHP
5.5
Yes
Yes
Yes
PHP
5.6
Yes
Yes
Yes
PHP
7.0
Yes
Yes
To find the default version of PHP on your server, run php --version . To find your servers operating system,
see Finding Your Servers Operating System.
81
82
where the string following the equal sign is the new DOCUMENT_ROOT path.
(e) Save and close the file.
2. Create php.ini if it does not already exist.
(a) Open an SSH session to your account.
(b) Enter touch ~/webapps/application/php.ini where application is the name of the
application as it appears in the control panel, and press Enter .
3. Edit php.ini .
(a) Open ~/webapps/application/php.ini in a text editor.
(b) Add a new line containing
auto_prepend_file = "/home/username/webapps/application/set_document_root.php"
where application is the name of the application as it appears in the control panel.
(c) Save and close the file.
Warning: FastCGI deployments do not use php.ini configuration files. If youre switching an existing PHP
application to FastCGI and that application has a php.ini file, please rename the file to .user.ini .
You can use FastCGI as an alternative deployment method for PHP scripts. Although it consumes your accounts
memory, it has better performance characteristics for some applications. To enable FastCGI:
1. Open $HOME/webapps/application/.htaccess in a text editor, where application is the name of
the PHP-based application.
2. Insert the following lines:
<FilesMatch \.php$>
SetHandler <handler>
</FilesMatch>
where <handler> is the FastCGI handler you want to use. Acceptable values are:
php54-fcgi
php55-fcgi
php56-fcgi
php70-fcgi
83
Additionally, you can run up to six FastCGI processes by appending an integer 2-6. For example, to use
FastCGI with PHP 5.4 and 3 processes, enter php54-fcgi3 in place of <handler> .
3. Save and close the file.
Subsequent requests will use FastCGI with the PHP interpreter and the number of processes you selected.
For servers Web119 and lower, edit or create a .htaccess file in the directory you want to serve HTML files as
PHP scripts to contain these lines:
<IfModule !php5_module>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} \.html$
RewriteRule (.*) http://127.0.0.1:2480/$1 [P]
</IfModule>
AddHandler php5-script html
Alternatively, to serve files ending in .php as if they were .html files, edit or create a .htaccess file in the
directory you want to serve the PHP files with the .html extension to contain these lines:
85
<IfModule !php5_module>
RewriteCond %{REQUEST_URI} \.html$
RewriteRule (.*) http://127.0.0.1:2480/$1 [P]
</IfModule>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} \.html$
RewriteRule (.*).html $1.php
Alternatively, the script may connect to and send mail from an SMTP server. There are several packages available
which simplify this method of sending mail:
Swift Mailer
PEARs Mail package
Zend Frameworks ZendMail
For example, this PHP script uses the PEAR Mail package to send an email:
<?php
require_once "Mail.php";
$from_addr = "Me <[email protected]>";
$to = "Team <[email protected]>";
$subject = "Hello!";
$body = "Dear Team, here is my message text.";
$headers = array ("From" => $from_addr,
"To" => $to,
"Subject" => $subject);
$smtp = Mail::factory("smtp", array ('host' => "smtp.webfaction.com",
'auth' => true,
'username' => "my_mailbox_name",
'password' => "password1"));
$mail = $smtp->send($to, $headers, $body);
?>
For this script to work, the values for from_addr, my_mailbox_name, and password1 would be changed to an
outgoing address, a valid WebFaction mailbox name, and a valid mailbox password, respectively.
86
16.12 Troubleshooting
16.12.1 Error: 500 Internal Server Error
See also:
For additional troubleshooting recommendations, please see the general CGI 500 Internal Server Error
documentation.
Error: Premature end of script headers:
php54.cgi
A 500 Internal Server Error in the browser and an error like this in the
$HOME/logs/frontend/error_website_php.log file:
[Thu Mar 22 18:38:49 2012] [error] [client 123.456.78.9 ] Premature end of script headers: php54.cgi
See Configuring PHP for detailed instructions about creating and modifying php.ini .
2. For servers web120 and greater or dweb61 and greater, switch to the FastCGI PHP deployment method.
See Using FastCGI for detailed instructions on how to enable FastCGI.
87
Alternatively, you may modify the software to use the correct headers. For example, this problem can be solved for
Drupal by modifying the drupal_set_header function in includes/common.inc . Add this line to the
end of the function definition:
$header = str_replace('HTTP/1.1', $_SERVER["SERVER_PROTOCOL"], $header);
The line replaces the HTTP/1.1 header with the correct header based on PHPs server and execution environment
information.
88
CHAPTER
SEVENTEEN
Private MySQL and PostgreSQL instances are an alternative to your servers shared databases. Private database
instances are useful for taking greater control over how your databases are configured, or to resolve the bad neighbor
problem, where one user consumes too much of a shared databases resources.
Private database instances rely upon the servers globally-installed MySQL or PostgreSQL binaries, so WebFaction
continues to apply security patches for you. Private database instances run under your user account, so the instance
process counts toward your accounts memory allotment, and the instances files count toward your accounts disk
space allotment.
89
90
Exporting
To export the contents of a private MySQL database:
1. Open an SSH session to your account.
2. Enter
mysqldump --port=port --protocol=tcp --user database_user database_name --password > d
port is the instances port number,
database_user is a valid database username,
database_name is a database that the user has permissions to read, and
dump_file is the path to the dump file to be created,
and press Enter .
3. When prompted, enter your database password.
Your dump file is created at the path specified.
91
Importing
To import a dump file into a private MySQL database:
1. Open an SSH session to your account.
2. Enter
mysql --port=port --protocol=tcp --user database_user -D database_name --password < du
where:
port is the instances port number,
database_user is a valid database username,
database_name is a database that the user has permissions to use, and
dump_file is the path to the dump file,
and press Enter .
Note: If youre importing a dump file encoded with a character set other than utf8 (for example,
latin1 ), then you must invoke mysql with the --default_character_set encoding option,
where encoding is the name of the dump files encoding.
Thus, the complete command for importing a non- utf8 dump file is:
92
93
Exporting
To export the contents of a private PostgreSQL database:
1. Open an SSH session to your account.
2. Enter
pg_dump --host localhost --port port --username database_user --file dump_file databas
port is the instances port number,
database_user is a valid database username,
database_name is a database that the user has permissions to read, and
dump_file is the path to the dump file to be created,
and press Enter .
Your dump file is created at the path specified.
Importing
To import a dump file into a private PostgreSQL database:
1. Open an SSH session to your account.
2. Enter
psql --host localhost --port port --username database_user database_name < dump_file ,
where:
port is the instances port number,
94
Enter
pg_restore --host localhost --port port --username database_user --dbname database_nam
and press Enter .
The contents of the dump file are loaded into the database.
95
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.',
'NAME': '<DATABASE>',
'USER': '<USERNAME>',
'PASSWORD': '<PASS>',
'HOST': '<HOST>',
'PORT': '<PORT_NUMBER>',
}
}
96
6. Find a line starting with define(DB_HOST, and replace the line with
define(DB_HOST, 127.0.0.1:port); , where port is the port number assigned to your private
database instance.
7. Save and close the file.
97
98
CHAPTER
EIGHTEEN
PYRAMID
99
(d) Switch to the application directory. Enter cd $HOME/webapps/application and press Enter .
(e) Create a symlink to development.ini . Enter ln -fs ./project/development.ini and
press Enter .
See also:
If youre deploying an app to a non-root URL path (like example.com/myapp ), see Serving
Pyramid with a URL Prefix.
4. Restart the Pyramid application.
To make the Pyramid application available on the Web, add the Pyramid application to a website record.
18.3.1 Starting
If a Pyramid application is not already running, it is automatically started by a cron job every 20 minutes. To
manually start the application:
1. Open an SSH session to your account.
2. Enter $HOME/webapps/application/bin/start , where application is the name of the application
as it appears on the control panel, and press Enter .
100
18.3.2 Stopping
To stop a Pyramid application:
1. Open an SSH session to your account.
2. Enter $HOME/webapps/application/bin/stop , where application is the name of the application as
it appears on the control panel, and press Enter .
Note: When the Pyramid application was installed, a cron job was also created to automatically start the
applicationif its not already runningevery 20 minutes. If you wish to prevent the application from being started
automatically, this cron job must be removed. Please see Scheduling Tasks with Cron for details on modifying your
cron jobs.
18.3.3 Restarting
To restart a Pyramid application:
1. Open an SSH session to your account.
2. Enter $HOME/webapps/application/bin/restart , where application is the name of the
application as it appears on the control panel, and press Enter .
101
102
CHAPTER
NINETEEN
PYTHON
Python is installed on all WebFaction servers. For your convenience, several different Python versions are available.
All servers have Python 2.5 through Python 3.5 installed. CentOS 5 servers also have Python 2.4 installed.
The default version of Pythonthe version of Python that runs when you run the python commandvaries by
server:
Operating system
CentOS 5
CentOS 6
CentOS 7
2.4
2.6
2.7
Default python2
version
2.4
2.6
2.7
Default python3
version
3.3
3.3
3.5
103
for python to refer to another version during interactive SSH sessions. To create a python alias:
1. Open an SSH session.
2. Open $HOME/.bash_profile in a text editor.
3. On a new line, add alias python=pythonX.Y where X.Y is the Python version number. For example,
to use Python 2.7, add a new line containing alias python=python2.7 .
4. Save and close the file.
5. Reload $HOME/.bash_profile . Enter source $HOME/.bash_profile and press Enter .
Now all future interactive SSH sessions will use the specified Python version at the command line.
Note: The python alias will not be available in shell scripts or other situations where the alias is not defined. In
such cases, the explicit Python version should be called instead (for example, python2.7 ).
To use easy_install to install a package to a specific web application which makes use of the Python interpreter, enter
PYTHONPATH=$HOME/webapps/app_name/lib/pythonX.Y easy_install-X.Y --install-dir=$HOME/webap
where app_name is the name of the web application as it appears in the control panel and press Enter .
104
1. Make sure the destination directory exists. Enter mkdir -p $HOME/lib/pythonX.Y , where X.Y is the
Python version, and press Enter .
2. Install enter easy_install-X.Y egg_path , where egg_path is the path to the egg to install, and press
Enter .
To install an egg to a specific web application which makes use of the Python interpreter, enter
PYTHONPATH=$HOME/webapps/app_name/lib/pythonX.Y easy_install-X.Y --install-dir=$HOME/webap
where app_name is the name of the web application as it appears in the control panel and press Enter .
105
19.4 Troubleshooting
19.4.1 Fixing ImportError Exceptions
Python will raise an ImportError exception whenever it cannot find a particular package or module as requested
by an import statement. This is caused by the named module not appearing in any of the module search path
directories. The Python search path, represented in Python as the list sys.path , is constructed from Python
defaults, the PYTHONPATH environment variable, and direct manipulations to sys.path .
To see the contents of sys.path :
1. Run Python interactively. Enter pythonX.Y and press Enter .
2. At the prompt, enter import sys and press Enter .
3. At the prompt, enter print sys.path and press Enter . The contents of sys.path will be
displayed on screen.
By default, Python searches in this order:
1. the directory where Python is executed;
2. if applicable, the $HOME/webapps/app_name/lib/pythonX.Y directory where app_name is the
name of an application and X.Y is the Python version number;
3. the $HOME/lib/pythonX.Y directory;
4. directories specified by PYTHONPATH ;
5. the Standard Library;
6. built-in components of Python.
There are several possible fixes for this problem:
add the path of the module to PYTHONPATH in your $HOME/.bash_profile file,
add the path to the module to PYTHONPATH from the command line before executing the Python program
which raises the exception,
106
add the path to the module to sys.path before the import statement which raises the exception within
the offending program,
add the path to the module to myproject.wsgi for applications using WSGI,
or, install offending packages directly to a path where Python will find it.
See also:
For more information on how Python loads modules, please see The Python Tutorial 6. Modules.
Adding to PYTHONPATH from the $HOME/.bash_profile File
Adding an entry to the end of the PYTHONPATH environment variable is a persistent way to avoid
ImportError exceptions. Unfortunately, this approach can cause complications while debugging Python
programs, since the change to the PYTHONPATH environment variable happens silently, before you enter any
commands at all. This is especially apparent when using two or more versions of the same module.
To add the path to a Python module to the PYTHONPATH environment variable from the
$HOME/.bash_profile file:
1. Open $HOME/.bash_profile with a text editor.
2. Add export PYTHONPATH="path_to_module:$PYTHONPATH" to the end of the file.
3. Save and close the file.
Log out and log in for the changes to take effect.
Note: Changes to $HOME/.bash_profile only change sys.path for Python programs executed from a
shell session. This approach would not resolve ImportError exceptions associated with web applications and
other programs run with the help of cron.
19.4. Troubleshooting
107
import sys
sys.path.insert(0, "path_to_module")
where path_to_module is the path you wish to add to the module search path.
An equivalent method is to add to sys.path with the + operator like this:
import sys
sys.path = ["path_to_module1", "path_to_module2"] + sys.path
That method is common for for WSGI-based applications, where sys.path can be modified in the
myproject.wsgi file found in /home/username/webapps/appname/ . Typically, a
myproject.wsgi file contains a line similar to this:
Add additional paths to the list to include them in the scripts search path.
Adding to sys.path from httpd.conf
For web applications running on mod_wsgi, the Python module search path can be amended in the httpd.conf
file, found in /home/username/webapps/appname/apache2/conf/ . The file contains a line like this:
2. Create the temporary directory. Enter mkdir -p $HOME/tmp and press Enter . A new directory, tmp ,
is created in your home directory.
3. Configure the shell to use the new temporary directory. Enter export TEMP=$HOME/tmp and press
Enter .
4. Install the package.
19.4. Troubleshooting
109
110
CHAPTER
TWENTY
RUBY
Ruby is installed on all WebFaction servers. For your convenience, several different Ruby versions are available. All
servers have Ruby 1.9 through Ruby 2.2 installed. CentOS 5 and CentOS 6 servers also have Ruby 1.8.7 and Ruby
1.8.7 Enterprise Edition installed.
The default version of Rubythe version of Ruby that runs when you run the ruby commandvaries by server:
Operating system
CentOS 5
CentOS 6
CentOS 7
To identify the default version of Ruby on your server, run ruby --version .
To run a specific version of Ruby, run rubyX.Y , where X.Y is the Ruby version number. For example, to use Ruby
2.2, enter ruby2.2 .
111
The gem is downloaded and installed. To use the gems executables, the gems_dir/bin directory must be in the
PATH environment variable. Run export PATH=gems_dir/bin:$PATH in each session as needed, or add
the statement to your .bash_profile file.
112
CHAPTER
TWENTYONE
RUBY ON RAILS
Ruby on Rails, also known as Rails or RoR, is an open source Ruby web development framework. You can learn
more about Ruby on Rails at the Rails website.
Tip: Add bin to PATH
While working with a Ruby on Rails application, you may find it easier to add the applications bin directory to the
PATH environment variable and set the GEM_HOME environment variable, instead of specifying complete paths to
$HOME/webapps/app/bin and $HOME/webapps/app/gems .
To set the environment variables:
1. Switch to the directory of the Ruby application. Enter cd $HOME/webapps/app , where app is the name
of the application as it appears in the WebFaction control panel, and press Enter .
2. Enter export PATH=$PWD/bin:$PATH and press Enter .
3. Enter export GEM_HOME=$PWD/gems and press Enter .
4. Enter export RUBYLIB=$PWD/lib and press Enter .
Now, programs like gem and rake will work as expected for that application.
To revert the changes to PATH and GEM_HOME (to work with a different Ruby on Rails application, for example),
log out and log back in again.
113
114
6. Enter gem install gem_name , where gem_name is the name of the Ruby Gem you want to install, and
press Enter .
Common Gems
To install some common gems:
MySQL adapter MySQL/Ruby:
gem install mysql -- --with-mysql-config=$(which mysql_config)
PostgreSQL adapter postgres :
For servers Web300 and Dweb89 or greater:
gem install pg -- --with-pg-config=/usr/pgsql-9.1/bin/pg_config
For other servers: gem install pg -- --with-pg-config=/usr/bin/pg_config
Testing framework RSpec: gem install rspec
Web framework Sinatra: gem install sinatra
Note: If you do not want to install the Rdoc or ri documentation, use this version of the command:
gem install --no-rdoc --no-ri gem_name .
The gem and any of its specified dependencies will be downloaded and installed automatically.
115
1. Install ImageMagick.
(a) Open an SSH session to your account.
(b) Download ImageMagick. Enter
wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz and
press Enter . ImageMagick.tar.gz is created in the current directory.
(c) Unpack the ImageMagick archive. Enter tar -xf ImageMagick.tar.gz and press Enter . A
new directory, ImageMagick-version , where version is the ImageMagick version number, is
created.
(d) Switch to the ImageMagick directory. Enter cd ImageMagick-version and press Enter .
(e) Configure the ImageMagick build. Enter ./configure --prefix=$HOME --without-perl
and press Enter .
(f) Compile ImageMagick. Enter make and press Enter . ImageMagick compiles. This step may take
several minutes.
(g) Install ImageMagick to your home directory. Enter make install and press Enter .
(h) Return to your home directory. Enter cd and press Enter .
(i) Remove the installation files. Enter rm -r ImageMagick.tar.gz ImageMagick-version
and press Enter .
2. Add $HOME/bin to your PATH .
(a) Enter echo "export PATH=$HOME/bin:\$PATH" >> .bash_profile and press Enter .
(b) Reload your .bash_profile . Enter source .bash_profile and press Enter .
3. Install the RMagick gem.
(a) Enter export LD_LIBRARY_PATH=$HOME/lib and press Enter .
(b) Enter export PKG_CONFIG_PATH=$HOME/lib/pkgconfig/ and press Enter .
(c) Install the RMagick gem in your Ruby on Rails application.
The gem is now installed for your Rails application.
116
117
Note: These directions assume that your Ruby on Rails project is part of a publicly-accessible Git
repository. For more information, see the official Capistrano documentation.
(e) Set your deployment path. Replace # set :deploy_to, /var/www/my_app with
set :deploy_to, /home/username/webapps/railsapp , where username is your
WebFaction username and railsapp is the name of your Rails application as it appears on the control
panel.
(f) Set your temporary directory. On a new line, add set :tmp_dir, /home/username/tmp .
(g) Define a restart task. In the namespace :deploy do block, insert the following lines:
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
capture("#{deploy_to}/bin/restart")
end
end
(h) Set the restart task to run after deployments. On a new line, add
after deploy:publishing, deploy:restart .
(i) Save and close the file.
(j) Open config/deploy/staging.rb in a text editor.
(k) Insert these lines:
role :app, %w{[email protected]}
role :web, %w{[email protected]}
role :db, %w{[email protected]}
Before upgrading to a new version of Rails, review the release notes for the new version and any intermediate
versions of Rails and confirm that you have an up-to-date backup of your site.
See also:
For additional details and version-specific upgrade notes, see A Guide for Upgrading Ruby on Rails.
To upgrade Rails from one version to another:
1. Open an SSH session to your account.
2. Switch to the Rails application directory. Enter cd $HOME/webapps/rails_app , where rails_app is
the name of the Rails application, and press Enter .
3. Enter export PATH=$PWD/bin/:$PATH and press Enter .
4. Enter export GEM_HOME=$PWD/gems/ and press Enter .
5. Enter export RUBYLIB=$PWD/lib and press Enter .
6. Switch to your Rails project directory. Enter cd project , where project is the name of your Rails project,
and press Enter . For example, to use the default hello_world project, enter cd hello_world and
press Enter.
7. Open your projects Gemfile file in a text editor.
8. In the line containing gem rails, version , where version is the existing Rails version number,
replace the existing version number with the version number that you want to upgrade to. For example, to
upgrade from version 4.0.7 to version 4.0.8 , replace gem rails, 4.0.7 with
gem rails, 4.0.8 .
9. Save and close the file.
10. Update Rails and any applicable Rails dependencies. Enter bundle update rails and press Enter .
When the message Your bundle is updated! appears, Rails is updated. Libraries that are not in Rails
dependency tree remain unchanged.
11. Restart your rails application. Enter restart and press Enter .
Your application is now running the updated version of Rails that you specified in Gemfile .
119
to this:
production:
adapter: adapter_type
database: database_name
host: localhost
username: database_user
password: database_password
such that
adapter_type is either mysql for MySQL databases or postgresql for PostgreSQL
databases,
database_name is the name of the database as it appears in the WebFaction control panel,
database_user is set to the name of a database user with access to the specified database, and
database_password is the database users password.
(d) Save and close the file.
The Rails application is now configured and ready to use the specified database.
See also:
For other Action Mailer settings, see Action Mailer Basics.
3. Save and close the file.
120
21.12 Troubleshooting
21.12.1 Error: Were sorry, but something went wrong.
If you attempt to click Rails About your applications environment link, you may get an error like this:
Were sorry, but something went wrong.
Weve been notified about this issue and well take a look at it shortly.
This error occurs when the link is clicked in production rather than development mode. To switch your
Rails application to development :
1. Install sqlite3-ruby.
2. Open an SSH session to your account.
3. Open $HOME/webapps/app/nginx/conf/nginx.conf , where app is the name of the Rails
application as it appears in the control panel, in a text editor.
4. In the server block, add rails_env development; on a new line.
5. Save and close the file.
6. Restart the Rails application. Enter $HOME/webapps/rails/bin/restart and press Enter .
Note: Rails development mode consumes dramatically more resources than production . Be sure to return
to production mode when development is no longer needed.
21.12. Troubleshooting
121
For more information, see the Passenger wiki page Debugging application startup problems.
21.12.3 Error:
Missing secret_token and secret_key_base for
production environment
If your Rails application is running in production mode and you find this error message in your
~/webapps/rails_app/nginx/logs/error.log file:
*** Exception RuntimeError in Rack application object (Missing `secret_token` and `secret_key_base` f
then a secret key may not be configured for your application. The error may also be accompanied by a 502 Bad
Gateway error or Incomplete response received from application error in your web browser.
To set your Rails applications production mode secret key:
1. Open an SSH session to your account.
2. Make a secret key for your application.
(a) Switch to your Rails application directory. Enter cd $HOME/webapps/rails_app/ , where
rails_app is the name of your Rails application, and press Enter .
(b) Generate a secret key. Enter
GEM_HOME=$PWD/gems/ $PWD/bin/rake -f $PWD/project/Rakefile secret ,
where project is the name of your Rails project, and press Enter .
For example, to generate a secret key for the default hello_world Rails project, enter
GEM_HOME=$PWD/gems/ $PWD/bin/rake -f $PWD/hello_world/Rakefile secret
and press Enter .
A long sequence of hexadecimal characters (characters 0-9 and a-f) appears. This sequence of characters
is your secret key.
(c) Copy the secret key.
3. Configure your application to use the key you generated.
(a) Open ~/webapps/rails_app/nginx/conf/nginx.conf in a text editor.
(b) Set the SECRET_KEY_BASE environment variable. On a new line in the server block, add
passenger_env_var SECRET_KEY_BASE key; , where key the secret key you generated
earlier.
(c) Save and close the file.
4. Restart your Rails application. Enter $HOME/webapps/rails_app/bin/restart and press Enter .
The production mode secret key is set.
122
CHAPTER
TWENTYTWO
REDMINE
where:
<domain> is the domain name your Redmine application will send mail from (such as
example.com ),
<mailbox> is a mailbox name as it appears on the WebFaction control panel (for example,
username_redmine ), and
123
124
CHAPTER
TWENTYTHREE
SQLITE
125
3. Extract the archive. Enter tar -xf sqlite-autoconf-version.tar.gz , where version is the
version number, and press Enter . A new directory containing the source files,
sqlite-autoconf-version , is created in the current directory.
4. Switch to the source directory. Enter cd sqlite-autoconf-version and press Enter .
5. Configure the compilation. Enter ./configure --prefix=$HOME and press Enter .
6. Compile SQLite. Enter make and press Enter .
7. Install SQLite. Enter make install and press Enter .
8. Add the ~/bin directory to your PATH.
(a) Open ~/.bashrc in a text editor.
(b) Insert export PATH=$HOME/bin/:$PATH on a new line.
(c) Save and close the file.
126
CHAPTER
TWENTYFOUR
Static files, CGI scripts, and PHP pages can be served by two different, but related, types of applications, Static-only
and Static/CGI/PHP applications.
Static-only applications serve files through each WebFaction servers front-end nginx process, but never run CGI
scripts or interpret PHP pages. While limited to serving ordinary files, like HTML, images, and CSS, Static-only
applications serve media fast without additional memory consumption.
Static/CGI/PHP applications serve ordinary files like Static-only applications do, along with the ability to run CGI
scripts, interpret PHP pages, and customize settings with .htaccess files.
See also:
For more on how each server handles incoming requests and which processes are responsible for different activities,
please see The Life Cycle of a Request and Response.
24.1 Static-only
Static-only apps serve static files with the servers shared nginx process. A Static-only app is exclusively static; PHP
files, for example, will not be interpreted in a Static-only app. We suggest Static-only apps when you need to serve
static media (and only static media) fast with low memory consumption.
127
24.2 Static/CGI/PHP
Static/CGI/PHP apps, in addition to their role in serving static media, add the capacity to serve PHP pages, which are
processed by the PHP interpreter on the server. Static/CGI/PHP apps should only be used when you need to make use
of .htaccess files, PHP pages, or CGI scripts.
See also:
For additional, PHP-specific configuration and troubleshooting information, please see PHP.
128
order allow,deny
<deny directives>
allow from all
<Files .htaccess>
order allow,deny
deny from all
</Files>
where <deny directives> is any number of lines containing one directive each to deny access to IP
addresses or hostnames. Such directives take the form of deny from IP and deny from hostname ,
where IP is an IP address to be blocked and hostname is a hostname to be blocked. For example:
order allow,deny
deny from example.com
deny from 123.456.78.9
allow from all
<Files .htaccess>
order allow,deny
deny from all
</Files>
where EXTENSION is the file extension to apply the handler to and HANDLER is the handler to use.
For example, to treat .py files as ordinary text files instead of as CGI scripts, add these lines to your
.htaccess file:
<FilesMatch \.py$>
SetHandler default-handler
</FilesMatch>
For another example, to treat .xyz files as CGI scripts, add these lines to your .htaccess file:
<FilesMatch \.xyz$>
SetHandler cgi-script
</FilesMatch>
24.2. Static/CGI/PHP
129
130
24.2. Static/CGI/PHP
131
If a site is only available over HTTPS, then use this method to automatically redirect from http://domain to
https://domain :
1. Create website with a static application for redirecting incoming requests.
(a) Log in to the control panel.
(b) Click Domains / websites Websites. The list of websites appears.
(c) Click the Add new website button. The Create a new website form appears.
(d) In the Name field, enter a website name.
(e) If applicable, in the Machine menu, click to select the server to host the website.
(f) If applicable, in the IP address menu, click to select the IP address to serve the site.
(g) For each domain name you want to redirect from HTTP to HTTPS, add it to the list of domains. In the
Domains field, enter the domain name. Enter one or more domain names. If the domain has not yet been
added to the control panel, click the Create link that appears at the bottom of the list of domains to add it.
Note: Dont forget to point new domains to the WebFaction name servers.
(h) Click Add an application Create a new application. The Create a new web app form appears.
(i) In the Name field, enter a name for the application.
(j) In the App category menu, click to select Static.
(k) In the App type menu, click to select Static/CGI/PHP-5.6.
(l) Click the Save button. The application is installed and added to websites list of applications.
(m) Click the Save button. The website is created and added to the list of websites.
2. Add the redirect rule.
(a) In a text editor, open ~/webapps/app_name/.htaccess , where app_name is the name of the
new Static/CGI/PHP application.
(b) Append the following lines:
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-SSL} !on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
132
(c) Click the Add new website button. The Create a new website form appears.
(d) In the Name field, enter a website name.
(e) If applicable, in the Machine menu, click to select the server to host the website.
(f) If applicable, in the IP address menu, click to select the IP address to serve the site.
(g) For each origin domain, add it to the list of domains. In the Domains field, enter the domain name. Enter
one or more domain names. If the domain has not yet been added to the control panel, click the Create
link that appears at the bottom of the list of domains to add it.
Note: Dont forget to point new domains to the WebFaction name servers.
(h) Click Add an application Create a new application. The Create a new web app form appears.
(i) In the Name field, enter a name for the application.
(j) In the App category menu, click to select Static.
(k) In the App type menu, click to select Static/CGI/PHP-5.6.
(l) Click the Save button. The application is installed and added to websites list of applications.
(m) Click the Save button. The website is created and added to the list of websites.
2. Add the redirect rule.
(a) In a text editor, open ~/webapps/app_name/.htaccess , where app_name is the name of the
new Static/CGI/PHP application.
(b) Append the following lines:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^origin_domain$ [NC]
RewriteRule ^(.*)$ http://destination_domain/$1 [R=301,L]
Thus, the file to redirect example.com to www.example.com would look like this:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
24.2. Static/CGI/PHP
133
in which www is the only directory to be served publicly. In situations like this, use a Symbolic link application. A
Symbolic link application works like a Static/CGI/PHP application, except that files are served from a directory you
choose (instead of a ~/webapps/app_name/ directory). The directory you choose can be any directory that you
have access to (including directories inside other applications).
To create a simple website that serves from a subdirectory:
1. Log in to the WebFaction control panel.
2. Click Domains / websites Websites. The list of websites appears.
3. Click the Add new website button. The Create a new website form appears.
4. In the Name field, enter a website name.
5. In the domains field, enter a domain name.
6. Click Add an application Create a new application. The Create a new web app form appears.
7. In the Name field, enter a name for the application.
8. In the App category menu, click to select Symbolic link.
9. In the Extra info field, enter the full path to the subdirectory to be served (for example,
/home/demo/demosource/www/ ). The path must point to an existing directory; the path is not created
for you.
10. Click the Save button. The application is installed and added to the websites list of applications.
11. Click the Save button. The website is created and added to the list of websites.
Now, the contents of the directory are served at the root of the specified domain.
24.3 Troubleshooting
24.3.1 Error: 500 Internal Server Error
A 500 Internal Server Error is a generic error, which indicates that the Apache failed to complete a response. In other
words, Apache failed to do something during the request. To resolve these errors, its best to look in the error log for
the Static/CGI/PHP application responsible for the error. The error log is
134
[Thu Sep 16 12:00:00 2010] [error] [client 12.345.678.9] (13)Permission denied: exec of '/home/<usern
it means that the permissions for your script are set incorrectly. Your user account must have execute permissions on
the file and its parent directory.
To set the correct permissions:
1. Open an SSH session to your account.
2. Switch to the directory of the script. Enter cd script_dir , where script_dir is the path to the directory
where the offending script is, and press Enter .
3. Set the file permissions on the script and its parent directory. Enter chmod 711 .
is the file name of the script, and press Enter .
Your script should now run without the Permission denied error.
Error: Premature end of script headers
If you encounter the 500 Internal Server Error in the browser and this error in your log file:
[Thu Sep 16 12:00:00 2010] [error] [client 12.345.678.9] Premature end of script headers: <script nam
a likely cause is that the permissions for your CGI script are set incorrectly. Your user account must have a minimal
set of execute permissions on the file and its containing directory such that:
the script is executable by the user,
the scripts parent directories (up to its containing Static/CGI/PHP application) are executable by the user;
the script is not writable by group or other, and
the scripts parent directories (up to its containing Static/CGI/PHP application) are not writable by group or
other.
To set the correct permissions:
1. Open an SSH session to your account.
2. Switch to the directory of the script. Enter cd script_dir , where script_dir is the path to the directory
where the offending script is, and press Enter .
24.3. Troubleshooting
135
3. Set the file permissions on the script and its parent directory. Enter chmod 711 .
is the file name of the script, and press Enter .
For any additional parent directories enter chmod 711 dirs , where dirs are a space-separated list of paths
to directories, and press Enter .
The scripts permissions should now be set appropriately.
Error: No such file or directory
If you encounter the 500 Internal Server Error in the browser and this error in your
$HOME/logs/frontend/error_website_php.log log file:
[Thu Sep 16 12:00:00 2010] [error] [client 12.345.678.9] (2)No such file or directory: exec of '/home
Now the file has the correct line endings for use on the WebFaction server. Alternatively, you may reconfigure your
STFP client to save uploaded files with the proper line endings.
Incorrect Shebang Line
Many scripts begin with a shebang line to indicate which interpreter is to be used to run the script. For example, a
Python 3.4 scripts shebang line might look like this:
#!/usr/bin/env python3.4
If the shebang line points to an interpreter that doesnt exist, however, the script will fail with an error.
A similar error will appear when the script is run from the command line. For example:
$ ./test.py
-bash: ./test.py: /usr/bin/env pyton2.5: bad interpreter: No such file or directory
This error indicates that the path specified on the shebang line does not exist. In the example, theres a typo:
pyton . Once the typo is corrected, the script will run without error.
136
[Thu Sep 16 12:00:00 2010] [error] [client 12.345.678.9] /path/to/.htaccess: Invalid command '<token>
[Thu Sep 16 12:00:00 2010] [error] [client 12.345.678.9] /path/to/.htaccess: Illegal option <token>,
Then it means that there is an error in your .htaccess file. Make sure your .htaccess file does not contain
any syntax errors or misspelled directives. Any error in the file will cause the entire .htaccess file to fail.
Error: Request exceeded the limit of 10 internal redirects
If you encounter a 500 Internal Server Error and one of these errors in your
$HOME/logs/frontend/error_website_php.log log file:
[Thu Sep 16 12:00:00 2010] [error] [client 12.345.678.9] Request exceeded the limit of 10 internal re
Then it means that Apache was unable to resolve a redirect in your site. Typically, this error can be resolved by
setting RewriteBase in the applications .htaccess file.
24.3. Troubleshooting
137
2. Enter chmod g+s directory where directory is the path to the directory where files are owned by
apache, and press Enter .
138
CHAPTER
TWENTYFIVE
SUBVERSION
Subversion is a version control system. Like other version control systems, Subversion (also known as svn ) allows
you to track changes to files over time, to make it easier to combine multiple authors changes to files and to maintain
a record of known good revisions.
139
msg = (
"To: %(to_email)s\r\n"
"From: %(from_email)s\r\n"
"Subject: Subversion post-commit: r%(revision)s\r\n"
"Content-type: text/plain\r\n"
"\r\n"
"Repository: %(repository)s\r\n"
"Revision: %(revision)s\r\n"
"Diff:\r\n"
"%(diff)s\r\n"
)
msg = msg % locals()
server.sendmail(from_email, to_email, msg)
server.quit()
140
3. Create a symlink
from the primary applications .htpasswd file to the secondary applications .htpasswd location. Enter
ln -s ~/webapps/primary_application/.htpasswd ~/webapps/secondary_applicaiton/.htpassw
> dump_file , where dump_file is the path to the file in which to store the
Note: To prevent your dump from being stopped for excessive processor utilization (particularly for
repositories with many commits or a large total file size), prefix the svnadmin command with the nice
command for deference to other processes:
nice -n 19 svnadmin dump .
> dump_file
141
2. Switch to the directory of your Subversion application. Enter cd ~/webapps/svn , where svn is the name
of the Subversion application as it appears in the control panel, and press Enter .
3. Enter svnadmin dump --incremental --revision n . > dump_file , where n is the
revision number from which to begin backing up and dump_file is the path to the file in which to store the
backup, and press Enter .
For example, to backup all of the repository activity following revision 100, enter
svnadmin dump --incremental --revision 101 . > backup-101.dump and press
Enter .
The most common uses for incremental backups are in a post-commit hook to create a new incremental backup after
each commit or in a cron job to create new incremental backups on a schedule.
< dump_file where dump_file is the path to the backup, and press
If you are restoring incremental backups, begin with the oldest backup first and progress to the newest. For
example, suppose there are three incremental backup files, r0to100.dump , r101to200.dump , and
r201to300.dump ; the backups would be restored like so:
$ svnadmin load . < r0to100.dump
$ svnadmin load . < r101to200.dump
$ svnadmin load . < r201to300.dump
Alternatively, restoration can be completed in one command by concatenating the dump files:
svnadmin load .
Note: To prevent your restoration from being stopped for excessive processor utilization (particularly for
repositories with many commits or a large total file size), prefix the svnadmin command with the nice
command for deference to other processes:
nice -n 19 svnadmin load .
142
< dump_file
CHAPTER
TWENTYSIX
TRAC
143
(f) In the Extra info field, enter the name of the version control repository application.
(g) Click the Save button.
3. Create a website to serve the version control repository and Trac applications.
(a) Click Domains / websites Websites. The list of websites appears.
(b) Click the Add new website button. The Create a new website form appears.
(c) In the Name field, enter a website name.
(d) If applicable, in the Machine menu, click to select the server to host the website.
(e) If you want your site served over an HTTPS connection, click to select Encrypted website (https).
See also:
Secure Sites (HTTPS)
(f) For each domain name you want to use with the website, add it to the list of domains. In the Domains
field, enter the domain name. Enter one or more domain names. If the domain has not yet been added to
the control panel, click the Create link that appears at the bottom of the list of domains to add it.
Note: Dont forget to point new domains to the WebFaction name servers.
(g) Click Add an application Reuse an existing application. The Reuse an existing web app form appears.
(h) Click to select the Trac application.
(i) Click the Save button. The application is added to the websites list of applications.
(j) Click Add an application Reuse an existing application. The Reuse an existing web app form appears.
(k) Click to select the version control repository application.
(l) In the URL field, enter a URL path for the repository (for example, /repository , /svn , or
/git ).
(m) Click the Save button. The application is added to the websites list of applications.
(n) Click the Save button. The website is created and added to the list of websites.
4. Wait two minutes for the changes to take effect.
Now your Trac site is ready to use at the specified domain.
144
145
146
2. Switch to the Trac application directory. Enter cd ~/webapps/trac , where trac is the name of the Trac
application as it appears on the control panel, and press Enter .
3. Enter echo -e "Satisfy Any\nAllow from all" > .htaccess and press Enter .
3. Replace the existing path with an absolute path to the root of a Git repository.
4. Save and close the file.
The Trac application will now use the repository found at the specified path.
Note: In the control panel, the Trac applications Extra info field will continue to show the name of the Git
application used when the Trac application was originally installed.
147
148
149
150
CHAPTER
TWENTYSEVEN
WEBDAV
WebDAV applications expose a directorys contents (including subdirectories) to a controlled set of users over HTTP.
There are two kinds of WebDAV applications available through the WebFaction control panel: a standard WebDAV
application and a symlink application. The standard application creates a directory in your ~/webapps directory.
The symlink application does not create its own directory; instead, you must provide the path to an existing directory
in the application installers Extra info field.
Standard and symlink WebDAV applications can only be accessed with a valid username and password. Valid
usernames and passwords are stored in a .htpasswd file in the WebDAV applications directory (if the file doesnt
already exist, the installer creates one automatically).
Note: WebDAV applications use HTTP basic access authentication. Basic access authentication is unsupported
natively by Windows 7. To use a WebDAV application with Windows 7, use a stand-alone WebDAV client such as
Cyberduck.
Warning: WebDAV applications can only be mounted on the root URL path of a domain ( / ). We recommend
that you create a new subdomain for use with your WebDAV applications.
151
(h) If you selected WebDav Symlink, then enter the full path to the existing directory in the Extra info field.
For example, if you want to serve ~/webdav , then enter /home/username/webdav in the Extra
info field.
Warning: If you do not enter a valid path in the Extra info field, you must delete the application, then
create a new application with a valid path.
If you selected a standard WebDAV application, then continue to the next step.
(i) Click the Save button. The application is installed and added to the list of applications.
2. Add usernames and passwords.
Dont forget to add the WebDAV application to a new or existing website to make the application available on the
web.
152
3. Enter htpasswd -D .htpasswd user , where user is the username to be deleted, and press Enter .
A confirmation message appears.
153
154
CHAPTER
TWENTYEIGHT
WEBSTATS
WebFaction supports two website statistics tools, AWStats and Webalizer. These tools parse your website log files and
generate reports about visits.
28.1 AWStats
AWStats is an open source log analyzer.
28.2 Webalizer
Webalizer is an open source log analyzer.
155
156
CHAPTER
TWENTYNINE
WORDPRESS
157
The second parameter is the name of the database ( username_app_ , in this example).
9. Click the Export tab. The dump form appears.
10. Click to select Add DROP TABLE / VIEW / PROCEDURE / FUNCTION.
11. Click the Go button. Your browser will prompt or begin the download of the SQL file.
Restoring
To restore the content of your WordPress blog from a SQL dump:
1. Log in to the control panel.
2. Click Databases Databases
3. In the row of the WordPresss applications database, click phpMyAdmin. The phpMyAdmin login page
appears.
4. In the Username field, enter the name of the database user for the WordPress application.
Note: To find the WordPress applications database user, open ~/webapps/wp/wp-config.php in a
text editor, where wp is the name of the WordPress application, and look for a line like this:
define('DB_USER', 'username_app_');
158
The second parameter is the name of the database ( username_app_ , in this example).
9. Click the Import tab. The import form appears.
10. Click the Choose file button. Your systems file selection dialog appears. Select the SQL file to be restored and
dismiss the dialog.
11. Click the Go button. The file is processed and a confirmation message appears.
Upgrading Automatically
Note: WordPress can only be upgraded automatically with versions 2.7 or higher. Please see Upgrading Manually
for other versions of WordPress.
To upgrade a WordPress installation automatically:
1. Log in to WordPress.
2. Click Tools. The Tools menu expands.
29.1. Using WordPress
159
160
161
WordPress is a PHP-based application. Please see PHP and Static Files, CGI Scripts, and PHP Pages for additional
documentation.
163
164
(e) Verify the database hostname. The line starting define(DB_HOST, should end with
localhost); . If this is not set correctly, edit the line to contain the correct value.
(f) Save and close the file.
2. Verify the database users password is set correctly.
(a) Log in to the control panel.
(b) Click Domains / websites Applications. The list of applications appears.
(c) Click the name of your WordPress application in the list. The applications details appear.
(d) Make a note of the password in the Extra info section.
(e) Click Databases Database Users. The list of database users appears.
(f) In the list, click the user named app_wp .
Note: Some WordPress applications created before 2013 may use a database user like
username_app_wp , where username is your account name.
The users details appear.
(g) In the Password field, click Change. A Password field and Confirm password field appear.
(h) In the Password field, enter the password from the Extra info field you made a note of previously.
(i) In the Confirm Password field, reenter the password.
(j) Click the Save button. The password is changed and a confirmation message appears.
Your WordPress applications database should now be configured correctly.
165
9. In the URL field, enter the URL path your WordPress site (for example, /blog , or leave blank for the root of
the domain).
Note: The first application added to a website is assigned to the root URL path ( / ).
10. Click the Save button. The application is added to the websites list of applications.
11. Click the Save button. A confirmation appears.
The WordPress application will now use the correct domain.
166
INDEX
Symbols
403 Forbidden, 11
500 Internal Server Error, 87, 134
502 Bad Gateway, 11
503 Service Unavailable, 137
504 Gateway Timeout, 11
A
Action Mailer, 120
AWStats, 155
Installation, 155
B
Bazaar, 15
Installation, 17
Loggerhead, 17
Building (from source), 12
C
Cache-Control, 127
Capistrano, 117
Compiling (from source), 12
CPAN, 77
cpanminus, 77
Cron, 9
Custom app (listening on port), 19
Automatically restarting, 21
Creating, 21
D
Django, 22
Admin password, 42
ALLOWED_HOSTS, 29
Database configuration, 32
DEBUG, 36
Django Debug Toolbar, 36
Email, 30
FORCE_SCRIPT_NAME, 31
ImportError, 39
Internal Server Error, 40
manage.py, 38
Memcached, 29
Memory, 41
Password protection, 31
REMOTE_ADDR, 43
Restart, 32
Start up time, 41
Static media, 28
TemplateDoesNotExist, 40
Time zone, 30
TIME_ZONE, 30
Troubleshooting, 35
Trunk, 35
Tutorial, 23
Upgrade, 34
USE_TZ, 30
Drupal, 43
Back up, 45
Cache, 47
Clean URLs, 46
Email, 47
Sendmail, 47
Static media, 47
Troubleshooting, 48
Update, 45
Uploads, 47
E
Expires, 127
expires max, 127
F
FastCGI, 83
File permissions, 7
FORCE_SCRIPT_NAME, 31
G
Git, 48
Anonymous read access, 51
HTTPS, 52
Installation, 49
Repository cloning, 50
Repository creation, 49
RPC failed, 52
167
Troubleshooting, 52
Users, 51
Databases, 90
Users, 90
HTML, 85
HTTP Errors
403, 11
500, 40, 87, 134
502, 11
503, 137
504, 11
HTTPS
Redirect, 131
Node.js, 73
Not Found, 11
I
Illegal option, 136
Invalid command, 136
J
Joomla, 53
Email, 55, 56
Sendmail, 55
SMTP, 56
Upgrade, 55
L
Log in, 157
Loggerhead, 17
Logs, 3
Front-end, 3
User, 4
M
max-age, 127
Memcached, 56
Django, 29
Shut down, 57
Start up, 57
Memory usage, 4
Mercurial, 57
HgWeb, 59
Installation, 59
Publishing, 59
mod_wsgi, 64
Memory, 65
Python virtual environments, 66
Start up time, 65
MongoDB, 67
Installation, 69
Movable Type, 70
Email, 71, 72
Sendmail, 71
SMTP, 72
MySQL, 89
168
P
PEAR, 84
Perl, 76
CPAN, 77
cpanminus, 77
Installing modules, 77
Perlbrew, 78
Permissions, 7
PHP, 79
Configuration, 81, 82
DOCUMENT_ROOT, 82
Email, 86
FastCGI, 83
HTML, 85
PEAR, 84
php.ini, 81, 82
Sendmail, 86
Settings, 81, 82
Time zone, 87
Troubleshooting, 87
Upload limit, 82
PostgreSQL, 92
Databases, 93
Users, 93
Premature end of script headers, 135
Private database instances, 88
Configuration, 95
MySQL, 89
PostgreSQL, 92
ps, 4
Pyramid, 97
Deployment, 99
Restart, 100
Start, 100
Stop, 100
URL prefix, 100
Python, 101
Alias, 103
easy_install, 104
Eggs, 104
ImportError
ImportError, 106
Pip, 105
PYTHONPATH, 107
Search path, 103
setup.py, 105
Python Enhancement Proposals
Index
PEP 333, 65
PYTHONPATH, 107
R
Rails
Secret key, 122
Redmine, 122
Email, 123
REMOTE_ADDR, 43
RPC failed, 52
Ruby, 109
Gems, 111
Ruby on Rails, 112
Action Mailer, 120
Capistrano, 117
Databases, 119
Deployment, 117
Installation, 113
Troubleshooting, 120
Upgrading, 118
RubyGems, 111
S
Site not configured, 10
SQLite, 124
Installation, 125
Static-only, 127
Static/CGI/PHP, 128
AddHandler, 129
Block a hostname, 128
Block an IP, 128
File handlers, 129
Hide configuration files, 130
HTTPS, 131
MIME types, 128
Password protection, 130
Redirect, 132
RewriteBase, 134
Server Side Includes, 130
SSI, 130
Subdirectory, 133
Symbolic link, 133
Troubleshooting, 134
Subversion, 138
Back up, 141
Email, 139
Post-commit hook, 139
Restore, 141
Users, 140
Trac, 147
Trac, 142
Email, 144
Getting started, 143
Logo, 147
reStructuredText, 145
Time zone, 147
Upgrade, 148
Users, 145
V
Version control
Bazaar, 15
Git, 48
W
Webalizer, 155
Installation, 155
WebDAV, 149
Setup, 151
Users, 152
WebSocket, 21
Webstats, 153
WordPress, 156, 157
Back up, 158
Caching, 162
Domain, 165
Email, 159
Error establishing a database connection, 164
MU, 162
Multisite, 162
Restore, 158
Sendmail, 159
Static media, 162
Troubleshooting, 164
Upgrade, 159
Uploads, 162
WP Super Cache, 162
WP Super Cache, 162
T
Time zone
Django, 30
PHP, 87
Index
169