-
Notifications
You must be signed in to change notification settings - Fork 9
/
host_setup.txt
135 lines (90 loc) · 3.29 KB
/
host_setup.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
Instructions are for Ubuntu 14.04
Configure python, install django and dependencies
sudo apt-get install python-setuptools
sudo apt-get install python-pip
sudo pip install django
sudo pip install django-simple-captcha
sudo apt-get install mysql-server
sudo pip install django-registration-redux
sudo apt-get install build-essential python-dev libmysqlclient-dev
sudo pip install MySQL-python
sudo apt-get build-dep python-imaging
sudo apt-get install libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev
cd /usr/share/fonts/truetype; sudo ln -s dejavu ttf-dejavu
sudo pip install --upgrade pillow
Install apache, lighttpd and phpmysql:
sudo apt-get install apache2
sudo apt-get install lighttpd
sudo apt-get install php5-fpm php5
Hack on /etc/lighttpd/lighttpd.conf:
At the top of the file, add server.port = 81
In server.modules, add:
"mod_fastcgi"
"mod_cgi"
sudo apt-get install phpmyadmin (select lighttpd as web server)
/etc/init.d/mysql start
To enable PHP5 in Lighttpd, we must modify /etc/php5/fpm/php.ini and
uncomment the line cgi.fix_pathinfo=1:
/etc/init.d/php5-fpm start
/etc/init.d/lighttpd start
cd /etc/lighttpd/conf-available/
cp 15-fastcgi-php.conf 15-fastcgi-php.conf.bak
vi 15-fastcgi-php.conf and make it look like the following
# /usr/share/doc/lighttpd-doc/fastcgi.txt.gz
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi
## Start an FastCGI server for php (needs the php5-cgi package)
fastcgi.server += ( ".php" =>
((
"socket" => "/var/run/php5-fpm.sock",
"broken-scriptfilename" => "enable"
))
)
To enable the fastcgi configuration, run the following commands:
lighttpd-enable-mod fastcgi
lighttpd-enable-mod fastcgi-php
Visit http://server:81/phpmymyadmin - it should be running
Login using the user and password configured when you installed the MySQL
package.
create database tscharts
new django.wsgi:
import os
import sys
sys.path.append('/home/ts/')
sys.path.append('/home/ts')
sys.path.append('/home/ts/tscharts')
sys.path.append('/home/ts/tscharts/')
sys.path.append('/home/ts/tscharts/tscharts')
sys.path.append('/home/ts/tscharts/tscharts/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
# end of new django.wsgi
sudo apt-get install libapache2-mod-wsgi
add following to end of /etc/apache2/apache2.conf:
WSGIScriptAlias / /home/slogan/ts/tscharts/tscharts/wsgi.py
WSGIPythonPath /home/slogan/ts/tscharts/
<Directory /home/slogan/ts/tscharts/tscharts/>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Alias /static/ /home/slogan/ts/tscharts/tscharts/static/
<Directory "/home/ts/tscharts/tscharts/static">
Require all granted
</Directory>
WSGIPassAuthorization On
SSL instructions:
sudo a2enmod ssl
sudo a2ensite default-ssl
sudo service apache2 restart
The above is from https://help.ubuntu.com/lts/serverguide/httpd.html#https-configuration - but I had to also do the following to get it to work without an
error:
sudo ln -s /etc/apache2/sites-available/default-ssl /etc/apache2/sites-enabled/000-default-ssl
sudo a2ensite default-ssl
sudo service apache2 restart
python manage.py syncdb
python manage.py runserver
For REST API:
pip install djangorestframework
Add following to /etc/apache2/apache2.conf
WSGIPassAuthorization On