-
Switch User Root
sudo -i -
Update and Install Package
apt-get update
apt-get install -y --force-yes python-pygraphviz python-setuptools unzip vim wget apache2 libapache2-mod-wsgi libapache2-mod-proxy-html -
Enable Apache Module
ln -s /etc/apache2/mods-available/proxy_http.load /etc/apache2/mods-enabled/proxy_http.load
a2enmod expires
a2enmod headers
a2enmod proxy
a2enmod proxy_http
a2enmod ssl
a2enmod wsgi -
Create Certificate
mkdir /etc/apache2/ssl
cd /etc/apache2/ssl
openssl genrsa 1024 > /etc/apache2/ssl/self_signed.key
chmod 400 /etc/apache2/ssl/self_signed.key
openssl req -new -x509 -nodes -sha1 -days 365 -key /etc/apache2/ssl/self_signed.key > /etc/apache2/ssl/self_signed.cert
openssl x509 -noout -fingerprint -text < /etc/apache2/ssl/self_signed.cert > /etc/apache2/ssl/self_signed.info -
Download and Extract Web2py
mkdir /home/www-data/
cd /home/www-data/
rm -f web2py_src.zip
wget -c http://web2py.com/examples/static/web2py_src.zip
unzip web2py_src.zip
chown -R www-data:www-data /home/www-data/web2py
mv web2py/handlers/wsgihandler.py web2py/wsgihandler.py -
Create Web2py Sites Available
echo '
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "/home/www-data/web2py/applications"
<Directory "C:/web2py">
Order allow,deny
Deny from all
</Directory>
<Location "/">
Order deny,allow
Allow from all
</Location>
<LocationMatch "^(/[\w_]*/static/.*)">
Order Allow,Deny
Allow from all
</LocationMatch>
WSGIScriptAlias / "/home/www-data/web2py/wsgihandler.py"
</VirtualHost>
NameVirtualHost *:443
<VirtualHost *:443>
DocumentRoot "/home/www-data/web2py/applications"
<Directory "/home/www-data/web2py/">
Order allow,deny
Deny from all
</Directory>
<Location "/">
Order deny,allow
Allow from all
</Location>
<LocationMatch "^(/[\w_]*/static/.*)">
Order Allow,Deny
Allow from all
</LocationMatch>
WSGIScriptAlias / "/home/www-data/web2py/wsgihandler.py"
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/self_signed.cert
SSLCertificateKeyFile /etc/apache2/ssl/self_signed.key
</VirtualHost>
' > /etc/apache2/sites-available/default -
Restart Service
service apache2 restart
Comments (1)
0
simakwm 10 years ago
It's working great as far as I've tested it. But the admin is "disabled because it cannot read a password file" =(
replies (1)