diff --git a/VERSION b/VERSION index 91e7863a..5ddf11eb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.5.1-stable+timestamp.2013.06.16.07.20.03 +Version 2.5.1-stable+timestamp.2013.06.16.16.58.29 diff --git a/scripts/setup-web2py-nginx-uwsgi-centos64.sh b/scripts/setup-web2py-nginx-uwsgi-centos64.sh index d098eb45..bd794282 100644 --- a/scripts/setup-web2py-nginx-uwsgi-centos64.sh +++ b/scripts/setup-web2py-nginx-uwsgi-centos64.sh @@ -2,54 +2,54 @@ # Autor: Nilton OS -- www.linuxpro.com.br echo 'setup-web2py-nginx-uwsgi-centos64.sh' echo 'Support CentOS 6.4' -echo 'Installs Nginx 1.4 + uWSGI + Web2py' - - +echo 'Installs Nginx 1.4.1 + uWSGI + Web2py' + + # Get Web2py Admin Password echo -e "Web2py Admin Password: \c " read PW - + echo -e "Set Server Name Ex: web2py.domain.com : \c " read SERVER_FQDN - + echo -e "Set Server IP: \c " read SERVER_IP - - + + echo "" >>/etc/hosts echo "$SERVER_IP $SERVER_FQDN" >>/etc/hosts - + yum update -y - + yum install -y http://mirror-fpt-telecom.fpt.net/fedora/epel/6/i386/epel-release-6-8.noarch.rpm yum clean all yum install -y gcc libxml2-devel python-devel python-pip PyXML unzip make sudo - + ## 64Bits System -## yum install -y http://nginx.org/packages/rhel/6/x86_64/RPMS/nginx-1.4.0-1.el6.ngx.x86_64.rpm -yum install -y http://nginx.org/packages/rhel/6/i386/RPMS/nginx-1.4.0-1.el6.ngx.i386.rpm - - +## yum install -y http://nginx.org/packages/rhel/6/x86_64/RPMS/nginx-1.4.1-1.el6.ngx.x86_64.rpm +yum install -y http://nginx.org/packages/rhel/6/i386/RPMS/nginx-1.4.1-1.el6.ngx.i386.rpm + + pip-python install --upgrade pip PIPPATH=`which pip` $PIPPATH install --upgrade uwsgi - - + + # Prepare folders for uwsgi mkdir /etc/uwsgi mkdir /var/log/uwsgi mkdir -p /var/www/ - + #usermod -a -G apache nginx mkdir -p /etc/nginx/ssl/ - - + + cd /etc/nginx/ssl openssl genrsa 1024 > web2py.key && 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 - - + + echo 'server { listen YOUR_SERVER_IP:80; server_name YOUR_SERVER_FQDN; @@ -69,6 +69,10 @@ echo 'server { include /etc/nginx/uwsgi_params; uwsgi_param UWSGI_SCHEME $scheme; uwsgi_param SERVER_SOFTWARE nginx/$nginx_version; + + ### remove the comments if you use uploads (max 10 MB) + #client_max_body_size 10m; + ### } } server { @@ -88,36 +92,42 @@ server { include /etc/nginx/uwsgi_params; uwsgi_param UWSGI_SCHEME $scheme; uwsgi_param SERVER_SOFTWARE nginx/$nginx_version; - } - -}' >/etc/nginx/conf.d/web2py.conf + ### remove the comments if you use uploads (max 10 MB) + #client_max_body_size 10m; + ### + } + +}' >/etc/nginx/conf.d/web2py.conf + sed -i "s/YOUR_SERVER_IP/$SERVER_IP/" /etc/nginx/conf.d/web2py.conf sed -i "s/YOUR_SERVER_FQDN/$SERVER_FQDN/" /etc/nginx/conf.d/web2py.conf + + +# Create configuration file /etc/uwsgi/web2py.ini +echo '[uwsgi] - -# Create configuration file /etc/uwsgi/web2py.xml -echo ' - /var/www/web2py/logs/web2py.socket - /var/www/web2py/ - /=wsgihandler:application - - 4 - 60 - 8 - 1 - /var/www/web2py/logs/stats.socket - 2000 - 512 - 256 - 192 - nginx - nginx - 0 0 -1 -1 -1 python /var/www/web2py/web2py.py -Q -S welcome -M -R scripts/sessions2trash.py -A -o - -' >/etc/uwsgi/web2py.xml - - +socket = /var/www/web2py/logs/%n.socket +pythonpath = /var/www/web2py/ +mount = /=wsgihandler:application +processes = 4 +master = true +harakiri = 60 +reload-mercy = 8 +cpu-affinity = 1 +stats = /tmp/%n.stats.socket +max-requests = 2000 +limit-as = 512 +reload-on-as = 256 +reload-on-rss = 192 +uid = nginx +gid = nginx +cron = 0 0 -1 -1 -1 python /var/www/web2py/web2py.py -Q -S welcome -M -R scripts/sessions2trash.py -A -o +no-orphans = true +chmod-socket = 666 +' >/etc/uwsgi/web2py.ini + + cd /var/www/ curl --progress -O http://web2py.com/examples/static/web2py_src.zip unzip web2py_src.zip && rm -rf web2py_src.zip @@ -126,11 +136,11 @@ curl --output /var/www/web2py/scripts/sessions2trash.py http://web2py.googlecode chown -R nginx:nginx web2py cd /var/www/web2py sudo -u nginx python -c "from gluon.main import save_password; save_password('$PW',443)" - - - + + + ## Daemons /start/stop - + echo '#!/bin/sh # Autor: Nilton OS -- www.linuxpro.com.br # @@ -144,27 +154,27 @@ echo '#!/bin/sh # Default-Start: 3 5 # Default-Stop: 0 1 2 6 ### END INIT INFO - + # Source function library. . /etc/rc.d/init.d/functions - + # Check for missing binaries (stale symlinks should not happen) UWSGI_BIN=`which uwsgi` test -x $UWSGI_BIN || { echo "$UWSGI_BIN not installed"; if [ "$1" = "stop" ]; then exit 0; else exit 5; fi; } - + UWSGI_EMPEROR_MODE=true UWSGI_VASSALS="/etc/uwsgi/" UWSGI_OPTIONS="--enable-threads --logto /var/log/uwsgi/uwsgi.log" lockfile=/var/lock/subsys/uwsgi - + UWSGI_OPTIONS="$UWSGI_OPTIONS --autoload" - + if [ "$UWSGI_EMPEROR_MODE" = "true" ] ; then UWSGI_OPTIONS="$UWSGI_OPTIONS --emperor $UWSGI_VASSALS" fi - + case "$1" in start) echo -n "Starting uWSGI " @@ -188,19 +198,19 @@ case "$1" in ;; esac exit 0 '> /etc/init.d/uwsgi - + chmod +x /etc/init.d/uwsgi - + /etc/init.d/uwsgi start /etc/init.d/nginx start - + /etc/init.d/iptables stop chkconfig --del iptables - + chkconfig --levels 235 uwsgi on chkconfig --levels 235 nginx on - + ## you can reload uwsgi with #/etc/init.d/uwsgi restart ## to reload web2py only (without restarting uwsgi) -# touch /etc/uwsgi/web2py.xml +# touch /etc/uwsgi/web2py.ini \ No newline at end of file