added improved scripts/setup-web2py-nginx-uwsgi-ubuntu.sh, thanks Niphlod

This commit is contained in:
mdipierro
2012-12-20 09:22:24 -06:00
parent dcf0a7ccc9
commit 95b3ca839a
14 changed files with 60 additions and 53 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.3.2 (2012-12-20 09:02:23) dev Version 2.3.2 (2012-12-20 09:21:27) dev
+1
View File
@@ -0,0 +1 @@
-2
View File
@@ -340,5 +340,3 @@ class PaymenTech(object):
dom.getElementsByTagName('CustomerRefNum')[0].firstChild.data dom.getElementsByTagName('CustomerRefNum')[0].firstChild.data
return result return result
+1 -1
View File
@@ -1487,7 +1487,7 @@ class A(DIV):
(self['callback'], self['target'] or '', d) (self['callback'], self['target'] or '', d)
self['_href'] = self['_href'] or '#null' self['_href'] = self['_href'] or '#null'
elif self['cid']: elif self['cid']:
pre = self['pre_call'] + ';' if self['pre_call'] else '' pre = self['pre_call'] + ';' if self['pre_call'] else ''
self['_onclick'] = '%sweb2py_component("%s","%s");%sreturn false;' % \ self['_onclick'] = '%sweb2py_component("%s","%s");%sreturn false;' % \
(pre,self['_href'], self['cid'], d) (pre,self['_href'], self['cid'], d)
return DIV.xml(self) return DIV.xml(self)
-1
View File
@@ -154,4 +154,3 @@ def redirect(location='', how=303, client_side=False):
from gluon import current from gluon import current
if client_side and current.request.ajax: if client_side and current.request.ajax:
raise HTTP(200, **{'web2py-component-command': 'window.location.reload(true)'}) raise HTTP(200, **{'web2py-component-command': 'window.location.reload(true)'})
-1
View File
@@ -1,4 +1,3 @@
import os import os
import sys import sys
from collections import deque from collections import deque
+23 -12
View File
@@ -1,19 +1,24 @@
#!/bin/bash
echo 'setup-web2py-nginx-uwsgi-ubuntu-precise.sh' echo 'setup-web2py-nginx-uwsgi-ubuntu-precise.sh'
echo 'Requires Ubuntu 12.04 and installs Nginx + uWSGI + Web2py' echo 'Requires Ubuntu > 12.04 and installs Nginx + uWSGI + Web2py'
# Check if user has root privileges
if [[ $EUID -ne 0 ]]; then
echo "You must run the script as root or using sudo"
exit 1
fi
# Get Web2py Admin Password # Get Web2py Admin Password
echo -e "Web2py Admin Password: \c " echo -e "Web2py Admin Password: \c "
read PW read PW
# Upgrade and install needed software # Upgrade and install needed software
apt-get update apt-get update
apt-get -y upgrade apt-get -y upgrade
apt-get -y dist-upgrade
apt-get autoremove apt-get autoremove
apt-get autoclean apt-get autoclean
apt-get -y install nginx-full apt-get -y install nginx-full
apt-get -y install build-essential python-dev libxml2-dev python-pip apt-get -y install build-essential python-dev libxml2-dev python-pip unzip
pip install --upgrade pip pip install --upgrade pip
pip install --upgrade uwsgi PIPPATH=`which pip`
$PIPPATH install --upgrade uwsgi
# Create configuration file /etc/nginx/sites-available/web2py # Create configuration file /etc/nginx/sites-available/web2py
echo 'server { echo 'server {
listen 80; listen 80;
@@ -37,11 +42,16 @@ echo 'server {
} }
} }
server { server {
listen 443; listen 443 default_server ssl;
server_name $hostname; server_name $hostname;
ssl on;
ssl_certificate /etc/nginx/ssl/web2py.crt; ssl_certificate /etc/nginx/ssl/web2py.crt;
ssl_certificate_key /etc/nginx/ssl/web2py.key; ssl_certificate_key /etc/nginx/ssl/web2py.key;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_ciphers ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA;
ssl_protocols SSLv3 TLSv1;
keepalive_timeout 70;
location / { location / {
#uwsgi_pass 127.0.0.1:9001; #uwsgi_pass 127.0.0.1:9001;
uwsgi_pass unix:///tmp/web2py.socket; uwsgi_pass unix:///tmp/web2py.socket;
@@ -56,9 +66,12 @@ ln -s /etc/nginx/sites-available/web2py /etc/nginx/sites-enabled/web2py
rm /etc/nginx/sites-enabled/default rm /etc/nginx/sites-enabled/default
mkdir /etc/nginx/ssl mkdir /etc/nginx/ssl
cd /etc/nginx/ssl cd /etc/nginx/ssl
openssl genrsa -out web2py.key 1024
openssl req -batch -new -key web2py.key -out web2py.csr openssl genrsa 1024 > web2py.key
openssl x509 -req -days 1780 -in web2py.csr -signkey web2py.key -out web2py.crt chmod 400 web2py.key
openssl req -new -x509 -nodes -sha1 -days 1780 -key web2py.key > web2py.crt
openssl x509 -noout -fingerprint -text < web2py.crt > web2py.info
# Prepare folders for uwsgi # Prepare folders for uwsgi
sudo mkdir /etc/uwsgi sudo mkdir /etc/uwsgi
@@ -104,7 +117,6 @@ respawn
exec uwsgi --master --die-on-term --emperor /etc/uwsgi --logto /var/log/uwsgi/uwsgi.log exec uwsgi --master --die-on-term --emperor /etc/uwsgi --logto /var/log/uwsgi/uwsgi.log
' > /etc/init/uwsgi-emperor.conf ' > /etc/init/uwsgi-emperor.conf
# Install Web2py # Install Web2py
apt-get -y install unzip
mkdir /home/www-data mkdir /home/www-data
cd /home/www-data cd /home/www-data
wget http://web2py.com/examples/static/web2py_src.zip wget http://web2py.com/examples/static/web2py_src.zip
@@ -124,4 +136,3 @@ start uwsgi-emperor
# stop uwsgi-emperor # stop uwsgi-emperor
## to reload web2py only (without restarting uwsgi) ## to reload web2py only (without restarting uwsgi)
# touch /etc/uwsgi/web2py.xml # touch /etc/uwsgi/web2py.xml
-1
View File
@@ -75,4 +75,3 @@ if __name__ == "__main__":
apps = sys.argv[2:] apps = sys.argv[2:]
sync_main(file, apps) sync_main(file, apps)