If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!

 

  1. Switch User Root
    sudo -i

  2. 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

  3. 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

  4. 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

  5. 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

  6. 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

  7. Restart Service
    service apache2 restart

Related slices

Comments (1)

  • Login to post



  • 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)
    • stevevanchristie 10 years ago

      for install the web2py app, i think you can download it from your server (dropbox, google drive, etc) the web2py app (*.w2p) and then extract it on the web2py applications folder


Hosting graciously provided by:
Python Anywhere