cleanup of whitespaces in scripts
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.4.5-stable+timestamp.2013.03.29.02.12.57
|
Version 2.4.5-stable+timestamp.2013.03.29.02.29.39
|
||||||
|
|||||||
+4
-5
@@ -46,9 +46,9 @@ def allow_access(environ,host):
|
|||||||
filename = os.path.join(os.path.dirname(__file__),'access.wsgi.log')
|
filename = os.path.join(os.path.dirname(__file__),'access.wsgi.log')
|
||||||
f = open(filename,'a')
|
f = open(filename,'a')
|
||||||
try:
|
try:
|
||||||
f.write('\n'+header+'\n'+pprint+'\n')
|
f.write('\n'+header+'\n'+pprint+'\n')
|
||||||
finally:
|
finally:
|
||||||
f.close()
|
f.close()
|
||||||
app = environ['REQUEST_URI'].split('/')[1]
|
app = environ['REQUEST_URI'].split('/')[1]
|
||||||
keys = [key for key in environ if key.startswith('HTTP_')]
|
keys = [key for key in environ if key.startswith('HTTP_')]
|
||||||
headers = {}
|
headers = {}
|
||||||
@@ -58,8 +58,7 @@ def allow_access(environ,host):
|
|||||||
try:
|
try:
|
||||||
data = urllib.urlencode({'request_uri':environ['REQUEST_URI']})
|
data = urllib.urlencode({'request_uri':environ['REQUEST_URI']})
|
||||||
request = urllib2.Request(URL_CHECK_ACCESS % dict(app=app),data,headers)
|
request = urllib2.Request(URL_CHECK_ACCESS % dict(app=app),data,headers)
|
||||||
response = urllib2.urlopen(request).read().strip().lower()
|
response = urllib2.urlopen(request).read().strip().lower()
|
||||||
if response.startswith('true'): return True
|
if response.startswith('true'): return True
|
||||||
except: pass
|
except: pass
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
+80
-80
@@ -4,112 +4,112 @@ worker_processes 1;
|
|||||||
error_log /var/log/nginx/error_log info;
|
error_log /var/log/nginx/error_log info;
|
||||||
|
|
||||||
events {
|
events {
|
||||||
worker_connections 1024;
|
worker_connections 1024;
|
||||||
use epoll;
|
use epoll;
|
||||||
}
|
}
|
||||||
|
|
||||||
http {
|
http {
|
||||||
include /etc/nginx/mime.types;
|
include /etc/nginx/mime.types;
|
||||||
default_type application/octet-stream;
|
default_type application/octet-stream;
|
||||||
|
|
||||||
log_format main
|
log_format main
|
||||||
'$remote_addr - $remote_user [$time_local] '
|
'$remote_addr - $remote_user [$time_local] '
|
||||||
'"$request" $status $bytes_sent '
|
'"$request" $status $bytes_sent '
|
||||||
'"$http_referer" "$http_user_agent" '
|
'"$http_referer" "$http_user_agent" '
|
||||||
'"$gzip_ratio"';
|
'"$gzip_ratio"';
|
||||||
|
|
||||||
client_header_timeout 10m;
|
client_header_timeout 10m;
|
||||||
client_body_timeout 10m;
|
client_body_timeout 10m;
|
||||||
send_timeout 10m;
|
send_timeout 10m;
|
||||||
|
|
||||||
connection_pool_size 256;
|
connection_pool_size 256;
|
||||||
client_header_buffer_size 1k;
|
client_header_buffer_size 1k;
|
||||||
large_client_header_buffers 4 2k;
|
large_client_header_buffers 4 2k;
|
||||||
request_pool_size 4k;
|
request_pool_size 4k;
|
||||||
|
|
||||||
gzip on;
|
gzip on;
|
||||||
gzip_min_length 1100;
|
gzip_min_length 1100;
|
||||||
gzip_buffers 4 8k;
|
gzip_buffers 4 8k;
|
||||||
gzip_types text/plain;
|
gzip_types text/plain;
|
||||||
|
|
||||||
output_buffers 1 32k;
|
output_buffers 1 32k;
|
||||||
postpone_output 1460;
|
postpone_output 1460;
|
||||||
|
|
||||||
sendfile on;
|
sendfile on;
|
||||||
tcp_nopush on;
|
tcp_nopush on;
|
||||||
tcp_nodelay on;
|
tcp_nodelay on;
|
||||||
|
|
||||||
keepalive_timeout 75 20;
|
keepalive_timeout 75 20;
|
||||||
|
|
||||||
ignore_invalid_headers on;
|
ignore_invalid_headers on;
|
||||||
|
|
||||||
ssl_session_cache shared:SSL:10m;
|
ssl_session_cache shared:SSL:10m;
|
||||||
|
|
||||||
index index.html;
|
index index.html;
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 127.0.0.1;
|
listen 127.0.0.1;
|
||||||
server_name localhost;
|
server_name localhost;
|
||||||
|
|
||||||
access_log /var/log/nginx/localhost.access_log main;
|
access_log /var/log/nginx/localhost.access_log main;
|
||||||
error_log /var/log/nginx/localhost.error_log info;
|
error_log /var/log/nginx/localhost.error_log info;
|
||||||
|
|
||||||
root /var/www/localhost/htdocs;
|
root /var/www/localhost/htdocs;
|
||||||
}
|
}
|
||||||
|
|
||||||
# SSL example
|
# SSL example
|
||||||
server {
|
server {
|
||||||
listen 127.0.0.1:443;
|
listen 127.0.0.1:443;
|
||||||
server_name localhost;
|
server_name localhost;
|
||||||
|
|
||||||
ssl on;
|
ssl on;
|
||||||
ssl_certificate /etc/ssl/nginx/nginx-server.pem;
|
ssl_certificate /etc/ssl/nginx/nginx-server.pem;
|
||||||
ssl_client_certificate /etc/ssl/nginx/cacert.pem;
|
ssl_client_certificate /etc/ssl/nginx/cacert.pem;
|
||||||
ssl_certificate_key /etc/ssl/nginx/nginx.key;
|
ssl_certificate_key /etc/ssl/nginx/nginx.key;
|
||||||
ssl_verify_client optional;
|
ssl_verify_client optional;
|
||||||
|
|
||||||
access_log /var/log/nginx/localhost.ssl_access_log main;
|
access_log /var/log/nginx/localhost.ssl_access_log main;
|
||||||
error_log /var/log/nginx/localhost.ssl_error_log info;
|
error_log /var/log/nginx/localhost.ssl_error_log info;
|
||||||
|
|
||||||
root /var/www/localhost/htdocs;
|
root /var/www/localhost/htdocs;
|
||||||
|
|
||||||
set $web2pyroot /home/Desktop/source/michelecomitini-facebookaccess;
|
set $web2pyroot /home/Desktop/source/michelecomitini-facebookaccess;
|
||||||
|
|
||||||
|
|
||||||
location /pki/ {
|
location /pki/ {
|
||||||
root /var/www/localhost/html;
|
root /var/www/localhost/html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
location ^/(.*)/static/(.*) {
|
location ^/(.*)/static/(.*) {
|
||||||
alias $web2pyroot/applications/$1/static/$2;
|
alias $web2pyroot/applications/$1/static/$2;
|
||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
include /etc/nginx/scgi_params;
|
include /etc/nginx/scgi_params;
|
||||||
scgi_pass 127.0.0.1:4000;
|
scgi_pass 127.0.0.1:4000;
|
||||||
|
|
||||||
#Module ngx_http_ssl_module supports the following built-in variables:
|
#Module ngx_http_ssl_module supports the following built-in variables:
|
||||||
|
|
||||||
#$ssl_cipher returns the cipher suite being used for the currently established SSL/TLS connection
|
#$ssl_cipher returns the cipher suite being used for the currently established SSL/TLS connection
|
||||||
#$ssl_client_serial returns the serial number of the client certificate for the currently established SSL/TLS connection — if applicable, i.e., if client authentication is activated in the connection
|
#$ssl_client_serial returns the serial number of the client certificate for the currently established SSL/TLS connection — if applicable, i.e., if client authentication is activated in the connection
|
||||||
#$ssl_client_s_dn returns the subject Distinguished Name (DN) of the client certificate for the currently established SSL/TLS connection — if applicable, i.e., if client authentication is activated in the connection
|
#$ssl_client_s_dn returns the subject Distinguished Name (DN) of the client certificate for the currently established SSL/TLS connection — if applicable, i.e., if client authentication is activated in the connection
|
||||||
#$ssl_client_i_dn returns the issuer DN of the client certificate for the currently established SSL/TLS connection — if applicable, i.e., if client authentication is activated in the connection
|
#$ssl_client_i_dn returns the issuer DN of the client certificate for the currently established SSL/TLS connection — if applicable, i.e., if client authentication is activated in the connection
|
||||||
#$ssl_protocol returns the protocol of the currently established SSL/TLS connection — depending on the configuration and client available options it's one of SSLv2, SSLv3 or TLSv1
|
#$ssl_protocol returns the protocol of the currently established SSL/TLS connection — depending on the configuration and client available options it's one of SSLv2, SSLv3 or TLSv1
|
||||||
#$ssl_session_id the Session ID of the established secure connection — requires Nginx version greater or equal to 0.8.20
|
#$ssl_session_id the Session ID of the established secure connection — requires Nginx version greater or equal to 0.8.20
|
||||||
#$ssl_client_cert
|
#$ssl_client_cert
|
||||||
#$ssl_client_raw_cert
|
#$ssl_client_raw_cert
|
||||||
#$ssl_client_verify takes the value "SUCCESS" when the client certificate is successfully verified
|
#$ssl_client_verify takes the value "SUCCESS" when the client certificate is successfully verified
|
||||||
scgi_param SSL_PROTOCOL $ssl_protocol;
|
scgi_param SSL_PROTOCOL $ssl_protocol;
|
||||||
scgi_param HTTPS on;
|
scgi_param HTTPS on;
|
||||||
scgi_param SSL_CIPHER $ssl_cipher;
|
scgi_param SSL_CIPHER $ssl_cipher;
|
||||||
scgi_param SSL_CLIENT_SERIAL $ssl_client_serial;
|
scgi_param SSL_CLIENT_SERIAL $ssl_client_serial;
|
||||||
scgi_param SSL_CLIENT_S_DN $ssl_client_s_dn;
|
scgi_param SSL_CLIENT_S_DN $ssl_client_s_dn;
|
||||||
scgi_param SSL_CLIENT_I_DN $ssl_client_i_dn;
|
scgi_param SSL_CLIENT_I_DN $ssl_client_i_dn;
|
||||||
scgi_param SSL_SESSION_ID $ssl_session_id;
|
scgi_param SSL_SESSION_ID $ssl_session_id;
|
||||||
scgi_param SSL_CLIENT_CERT $ssl_client_cert;
|
scgi_param SSL_CLIENT_CERT $ssl_client_cert;
|
||||||
scgi_param SSL_CLIENT_RAW_CERT $ssl_client_raw_cert;
|
scgi_param SSL_CLIENT_RAW_CERT $ssl_client_raw_cert;
|
||||||
scgi_param SSL_CLIENT_VERIFY $ssl_client_verify;
|
scgi_param SSL_CLIENT_VERIFY $ssl_client_verify;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,4 +64,3 @@ case "$1" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|||||||
@@ -9,4 +9,3 @@ unzip web2py_src.zip
|
|||||||
cd web2py
|
cd web2py
|
||||||
# start web2py using command-line script
|
# start web2py using command-line script
|
||||||
w2env/bin/python web2py.py -i 0.0.0.0 -p 8123 -a 'adminpasswd'
|
w2env/bin/python web2py.py -i 0.0.0.0 -p 8123 -a 'adminpasswd'
|
||||||
|
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ wget http://rubyforge.org/frs/download.php/76628/redmine-2.2.0.tar.gz.md5
|
|||||||
md5sum --check redmine-2.2.0.tar.gz.md5 > redmine_md5_checked_successfully
|
md5sum --check redmine-2.2.0.tar.gz.md5 > redmine_md5_checked_successfully
|
||||||
if [ -f redmine_md5_checked_successfully ]
|
if [ -f redmine_md5_checked_successfully ]
|
||||||
then
|
then
|
||||||
tar xvfz redmine-2.2.0.tar.gz
|
tar xvfz redmine-2.2.0.tar.gz
|
||||||
rm redmine_md5_checked_successfully
|
rm redmine_md5_checked_successfully
|
||||||
else
|
else
|
||||||
echo "Redmine md5 check sum failed..."
|
echo "Redmine md5 check sum failed..."
|
||||||
exit 1
|
exit 1
|
||||||
@@ -195,18 +195,18 @@ SCRIPTNAME=/etc/init.d/redmine
|
|||||||
#
|
#
|
||||||
do_start()
|
do_start()
|
||||||
{
|
{
|
||||||
# Return
|
# Return
|
||||||
# 0 if daemon has been started
|
# 0 if daemon has been started
|
||||||
# 1 if daemon was already running
|
# 1 if daemon was already running
|
||||||
# 2 if daemon could not be started
|
# 2 if daemon could not be started
|
||||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|
||||||
|| return 1
|
|| return 1
|
||||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
|
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
|
||||||
$DAEMON_ARGS \
|
$DAEMON_ARGS \
|
||||||
|| return 2
|
|| return 2
|
||||||
# Add code here, if necessary, that waits for the process to be ready
|
# Add code here, if necessary, that waits for the process to be ready
|
||||||
# to handle requests from services started subsequently which depend
|
# to handle requests from services started subsequently which depend
|
||||||
# on this one. As a last resort, sleep for some time.
|
# on this one. As a last resort, sleep for some time.
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -214,96 +214,96 @@ do_start()
|
|||||||
#
|
#
|
||||||
do_stop()
|
do_stop()
|
||||||
{
|
{
|
||||||
# Return
|
# Return
|
||||||
# 0 if daemon has been stopped
|
# 0 if daemon has been stopped
|
||||||
# 1 if daemon was already stopped
|
# 1 if daemon was already stopped
|
||||||
# 2 if daemon could not be stopped
|
# 2 if daemon could not be stopped
|
||||||
# other if a failure occurred
|
# other if a failure occurred
|
||||||
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
|
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
|
||||||
RETVAL="$?"
|
RETVAL="$?"
|
||||||
[ "$RETVAL" = 2 ] && return 2
|
[ "$RETVAL" = 2 ] && return 2
|
||||||
# Wait for children to finish too if this is a daemon that forks
|
# Wait for children to finish too if this is a daemon that forks
|
||||||
# and if the daemon is only ever run from this initscript.
|
# and if the daemon is only ever run from this initscript.
|
||||||
# If the above conditions are not satisfied then add some other code
|
# If the above conditions are not satisfied then add some other code
|
||||||
# that waits for the process to drop all resources that could be
|
# that waits for the process to drop all resources that could be
|
||||||
# needed by services started subsequently. A last resort is to
|
# needed by services started subsequently. A last resort is to
|
||||||
# sleep for some time.
|
# sleep for some time.
|
||||||
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
|
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
|
||||||
[ "$?" = 2 ] && return 2
|
[ "$?" = 2 ] && return 2
|
||||||
# Many daemons don'\''t delete their pidfiles when they exit.
|
# Many daemons don'\''t delete their pidfiles when they exit.
|
||||||
rm -f $PIDFILE
|
rm -f $PIDFILE
|
||||||
return "$RETVAL"
|
return "$RETVAL"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Function that sends a SIGHUP to the daemon/service
|
# Function that sends a SIGHUP to the daemon/service
|
||||||
#
|
#
|
||||||
do_reload() {
|
do_reload() {
|
||||||
#
|
#
|
||||||
# If the daemon can reload its configuration without
|
# If the daemon can reload its configuration without
|
||||||
# restarting (for example, when it is sent a SIGHUP),
|
# restarting (for example, when it is sent a SIGHUP),
|
||||||
# then implement that here.
|
# then implement that here.
|
||||||
#
|
#
|
||||||
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
|
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
|
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
|
||||||
do_start
|
do_start
|
||||||
case "$?" in
|
case "$?" in
|
||||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
||||||
do_stop
|
do_stop
|
||||||
case "$?" in
|
case "$?" in
|
||||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||||
;;
|
;;
|
||||||
#reload|force-reload)
|
#reload|force-reload)
|
||||||
#
|
#
|
||||||
# If do_reload() is not implemented then leave this commented out
|
# If do_reload() is not implemented then leave this commented out
|
||||||
# and leave '\''force-reload'\'' as an alias for '\''restart'\''.
|
# and leave '\''force-reload'\'' as an alias for '\''restart'\''.
|
||||||
#
|
#
|
||||||
#log_daemon_msg "Reloading $DESC" "$NAME"
|
#log_daemon_msg "Reloading $DESC" "$NAME"
|
||||||
#do_reload
|
#do_reload
|
||||||
#log_end_msg $?
|
#log_end_msg $?
|
||||||
#;;
|
#;;
|
||||||
restart|force-reload)
|
restart|force-reload)
|
||||||
#
|
#
|
||||||
# If the "reload" option is implemented then remove the
|
# If the "reload" option is implemented then remove the
|
||||||
# '\''force-reload'\'' alias
|
# '\''force-reload'\'' alias
|
||||||
#
|
#
|
||||||
log_daemon_msg "Restarting $DESC" "$NAME"
|
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||||
do_stop
|
do_stop
|
||||||
case "$?" in
|
case "$?" in
|
||||||
0|1)
|
0|1)
|
||||||
do_start
|
do_start
|
||||||
case "$?" in
|
case "$?" in
|
||||||
0) log_end_msg 0 ;;
|
0) log_end_msg 0 ;;
|
||||||
1) log_end_msg 1 ;; # Old process is still running
|
1) log_end_msg 1 ;; # Old process is still running
|
||||||
*) log_end_msg 1 ;; # Failed to start
|
*) log_end_msg 1 ;; # Failed to start
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# Failed to stop
|
# Failed to stop
|
||||||
log_end_msg 1
|
log_end_msg 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
|
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
|
||||||
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
|
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
|
||||||
exit 3
|
exit 3
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
:' > /etc/init.d/redmine
|
:' > /etc/init.d/redmine
|
||||||
@@ -360,12 +360,12 @@ server {
|
|||||||
root /var/www;
|
root /var/www;
|
||||||
ssl_certificate /etc/nginx/ssl/self_signed.cert;
|
ssl_certificate /etc/nginx/ssl/self_signed.cert;
|
||||||
ssl_certificate_key /etc/nginx/ssl/self_signed.key;
|
ssl_certificate_key /etc/nginx/ssl/self_signed.key;
|
||||||
ssl_prefer_server_ciphers on;
|
ssl_prefer_server_ciphers on;
|
||||||
ssl_session_cache shared:SSL:10m;
|
ssl_session_cache shared:SSL:10m;
|
||||||
ssl_session_timeout 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_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;
|
ssl_protocols SSLv3 TLSv1;
|
||||||
keepalive_timeout 70;
|
keepalive_timeout 70;
|
||||||
location ~^\/(?!redmine(.*)) {
|
location ~^\/(?!redmine(.*)) {
|
||||||
#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;
|
||||||
@@ -392,8 +392,8 @@ server {
|
|||||||
# We copy ssl files we previously created
|
# We copy ssl files we previously created
|
||||||
if [ -f /etc/nginx/ssl ]
|
if [ -f /etc/nginx/ssl ]
|
||||||
then
|
then
|
||||||
cp ~/self_signed.* /etc/nginx/ssl/
|
cp ~/self_signed.* /etc/nginx/ssl/
|
||||||
rm ~/self_signed.*
|
rm ~/self_signed.*
|
||||||
else
|
else
|
||||||
mkdir /etc/nginx/ssl
|
mkdir /etc/nginx/ssl
|
||||||
cp ~/self_signed.* /etc/nginx/ssl/
|
cp ~/self_signed.* /etc/nginx/ssl/
|
||||||
|
|||||||
@@ -1,33 +1,33 @@
|
|||||||
#
|
#
|
||||||
# Author: Christopher Steel
|
# Author: Christopher Steel
|
||||||
# Organization: Voice of Access
|
# Organization: Voice of Access
|
||||||
# Date: 2010-11-24
|
# Date: 2010-11-24
|
||||||
# License: Same as Web2py, MIT / GNU
|
# License: Same as Web2py, MIT / GNU
|
||||||
# Email: Christopher DOT Steel AT Voice of Access DOT org
|
# Email: Christopher DOT Steel AT Voice of Access DOT org
|
||||||
#
|
#
|
||||||
# This script will :
|
# This script will :
|
||||||
# download and install virtualenv
|
# download and install virtualenv
|
||||||
# start a virtual environment
|
# start a virtual environment
|
||||||
# move into the virtual environment
|
# move into the virtual environment
|
||||||
# download and install latest stable version of web2py
|
# download and install latest stable version of web2py
|
||||||
# start web2py in the virtual environment
|
# start web2py in the virtual environment
|
||||||
#
|
#
|
||||||
# To disactivate the virtual environment, shut down web2py
|
# To disactivate the virtual environment, shut down web2py
|
||||||
# and type 'disactivate' at the command line.
|
# and type 'disactivate' at the command line.
|
||||||
#
|
#
|
||||||
# Testing:
|
# Testing:
|
||||||
# OS X
|
# OS X
|
||||||
# should work on POSIX systems
|
# should work on POSIX systems
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# create a directory to hold your virtual environments, for example
|
# create a directory to hold your virtual environments, for example
|
||||||
# /home/user_name/virtual_environments
|
# /home/user_name/virtual_environments
|
||||||
# place this script in the directory and make it executable
|
# place this script in the directory and make it executable
|
||||||
# chmod +x web2py-install-virtualenv.sh
|
# chmod +x web2py-install-virtualenv.sh
|
||||||
customize the variables below to meet your needs
|
customize the variables below to meet your needs
|
||||||
# execute from terminal
|
# execute from terminal
|
||||||
# ./web2py-install-virtualenv.sh
|
# ./web2py-install-virtualenv.sh
|
||||||
# relax...
|
# relax...
|
||||||
|
|
||||||
################ VARIABLES
|
################ VARIABLES
|
||||||
# Change to reflect version changes etc.
|
# Change to reflect version changes etc.
|
||||||
@@ -94,8 +94,3 @@ read -p "Press any key to start web2py…"
|
|||||||
echo 'starting web2py'
|
echo 'starting web2py'
|
||||||
echo '==============='
|
echo '==============='
|
||||||
../bin/python2.5 web2py.py
|
../bin/python2.5 web2py.py
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -398,4 +398,3 @@ cd ${current_directory}
|
|||||||
|
|
||||||
echo " - Complete!"
|
echo " - Complete!"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
|||||||
@@ -346,5 +346,3 @@ reboot
|
|||||||
|
|
||||||
as superuser
|
as superuser
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -175,4 +175,3 @@ cd /home/www-data/web2py
|
|||||||
sudo -u www-data python -c "from gluon.widget import console; console();"
|
sudo -u www-data python -c "from gluon.widget import console; console();"
|
||||||
sudo -u www-data python -c "from gluon.main import save_password; save_password(raw_input('admin password: '),443)"
|
sudo -u www-data python -c "from gluon.main import save_password; save_password(raw_input('admin password: '),443)"
|
||||||
echo "done!"
|
echo "done!"
|
||||||
|
|
||||||
|
|||||||
+14
-15
@@ -13,13 +13,13 @@
|
|||||||
TARGET=web2py
|
TARGET=web2py
|
||||||
|
|
||||||
if [ ! -d $TARGET ]; then
|
if [ ! -d $TARGET ]; then
|
||||||
# in case we're in web2py/
|
# in case we're in web2py/
|
||||||
if [ -f ../$TARGET/VERSION ]; then
|
if [ -f ../$TARGET/VERSION ]; then
|
||||||
cd ..
|
cd ..
|
||||||
# in case we're in web2py/scripts
|
# in case we're in web2py/scripts
|
||||||
elif [ -f ../../$TARGET/VERSION ]; then
|
elif [ -f ../../$TARGET/VERSION ]; then
|
||||||
cd ../..
|
cd ../..
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
read a VERSION c < $TARGET/VERSION
|
read a VERSION c < $TARGET/VERSION
|
||||||
SAVE=$TARGET-$VERSION
|
SAVE=$TARGET-$VERSION
|
||||||
@@ -32,14 +32,14 @@ SAVED=""
|
|||||||
# but don't overwrite a previous save of the same version.
|
# but don't overwrite a previous save of the same version.
|
||||||
#
|
#
|
||||||
if [ -f $SAVE.zip ]; then
|
if [ -f $SAVE.zip ]; then
|
||||||
echo "Remove or rename $SAVE.zip first" >&2
|
echo "Remove or rename $SAVE.zip first" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ -d $TARGET ]; then
|
if [ -d $TARGET ]; then
|
||||||
echo -n ">>Save old version: " >&2
|
echo -n ">>Save old version: " >&2
|
||||||
cat $TARGET/VERSION >&2
|
cat $TARGET/VERSION >&2
|
||||||
zip -q -r $SAVE.zip $TARGET
|
zip -q -r $SAVE.zip $TARGET
|
||||||
SAVED=$SAVE.zip
|
SAVED=$SAVE.zip
|
||||||
fi
|
fi
|
||||||
#
|
#
|
||||||
# Download the new version.
|
# Download the new version.
|
||||||
@@ -54,6 +54,5 @@ rm $ZIP
|
|||||||
echo -n ">>New version: " >&2
|
echo -n ">>New version: " >&2
|
||||||
cat $TARGET/VERSION >&2
|
cat $TARGET/VERSION >&2
|
||||||
if [ "$SAVED" != "" ]; then
|
if [ "$SAVED" != "" ]; then
|
||||||
echo ">>Old version saved as $SAVED"
|
echo ">>Old version saved as $SAVED"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -55,4 +55,3 @@ case "$1" in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|||||||
+36
-37
@@ -28,55 +28,54 @@ PYTHON=python
|
|||||||
cd $DAEMON_DIR
|
cd $DAEMON_DIR
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
echo -n $"Starting $DESC ($NAME): "
|
echo -n $"Starting $DESC ($NAME): "
|
||||||
daemon --check $NAME $PYTHON $DAEMON_DIR/web2py.py -Q --nogui -a $ADMINPASS -d $PIDFILE -p $PORT &
|
daemon --check $NAME $PYTHON $DAEMON_DIR/web2py.py -Q --nogui -a $ADMINPASS -d $PIDFILE -p $PORT &
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL -eq 0 ]; then
|
if [ $RETVAL -eq 0 ]; then
|
||||||
touch /var/lock/subsys/$NAME
|
touch /var/lock/subsys/$NAME
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
return $RETVAL
|
return $RETVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
echo -n $"Shutting down $DESC ($NAME): "
|
echo -n $"Shutting down $DESC ($NAME): "
|
||||||
killproc -p "$PIDFILE" -d 3 "$NAME"
|
killproc -p "$PIDFILE" -d 3 "$NAME"
|
||||||
echo
|
echo
|
||||||
if [ $RETVAL -eq 0 ]; then
|
if [ $RETVAL -eq 0 ]; then
|
||||||
rm -f /var/lock/subsys/$NAME
|
rm -f /var/lock/subsys/$NAME
|
||||||
rm -f $PIDFILE
|
rm -f $PIDFILE
|
||||||
fi
|
fi
|
||||||
return $RETVAL
|
return $RETVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
restart() {
|
restart() {
|
||||||
stop
|
stop
|
||||||
start
|
start
|
||||||
}
|
}
|
||||||
|
|
||||||
status() {
|
status() {
|
||||||
if [ -r "$PIDFILE" ]; then
|
if [ -r "$PIDFILE" ]; then
|
||||||
pid=`cat $PIDFILE`
|
pid=`cat $PIDFILE`
|
||||||
fi
|
fi
|
||||||
if [ $pid ]; then
|
if [ $pid ]; then
|
||||||
echo "$NAME (pid $pid) is running..."
|
echo "$NAME (pid $pid) is running..."
|
||||||
else
|
else
|
||||||
echo "$NAME is stopped"
|
echo "$NAME is stopped"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start) start;;
|
start) start;;
|
||||||
stop) stop;;
|
stop) stop;;
|
||||||
status) status;;
|
status) status;;
|
||||||
restart) restart;;
|
restart) restart;;
|
||||||
condrestart) [ -e /var/lock/subsys/$NAME ] && restart
|
condrestart) [ -e /var/lock/subsys/$NAME ] && restart
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
;;
|
;;
|
||||||
*) echo $"Usage: $0 {start|stop|restart|condrestart|status}"
|
*) echo $"Usage: $0 {start|stop|restart|condrestart|status}"
|
||||||
RETVAL=1
|
RETVAL=1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
exit $RETVAL
|
exit $RETVAL
|
||||||
|
|
||||||
|
|||||||
+108
-109
@@ -48,26 +48,26 @@ DAEMON_USER=web2py
|
|||||||
#
|
#
|
||||||
do_start()
|
do_start()
|
||||||
{
|
{
|
||||||
# Return
|
# Return
|
||||||
# 0 if daemon has been started
|
# 0 if daemon has been started
|
||||||
# 1 if daemon was already running
|
# 1 if daemon was already running
|
||||||
# 2 if daemon could not be started
|
# 2 if daemon could not be started
|
||||||
|
|
||||||
# The PIDDIR should normally be created during installation. This
|
# The PIDDIR should normally be created during installation. This
|
||||||
# fixes things just in case.
|
# fixes things just in case.
|
||||||
[ -d $PIDDIR ] || mkdir -p $PIDDIR
|
[ -d $PIDDIR ] || mkdir -p $PIDDIR
|
||||||
[ -n "$DAEMON_USER" ] && chown --recursive $DAEMON_USER $PIDDIR
|
[ -n "$DAEMON_USER" ] && chown --recursive $DAEMON_USER $PIDDIR
|
||||||
|
|
||||||
# Check to see if the daemon is already running.
|
# Check to see if the daemon is already running.
|
||||||
start-stop-daemon --stop --test --quiet --pidfile $PIDFILE \
|
start-stop-daemon --stop --test --quiet --pidfile $PIDFILE \
|
||||||
&& return 1
|
&& return 1
|
||||||
|
|
||||||
start-stop-daemon --start --quiet --pidfile $PIDFILE \
|
start-stop-daemon --start --quiet --pidfile $PIDFILE \
|
||||||
${DAEMON_USER:+--chuid $DAEMON_USER} --chdir $DAEMON_DIR \
|
${DAEMON_USER:+--chuid $DAEMON_USER} --chdir $DAEMON_DIR \
|
||||||
--background --exec $DAEMON -- $DAEMON_ARGS \
|
--background --exec $DAEMON -- $DAEMON_ARGS \
|
||||||
|| return 2
|
|| return 2
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -75,17 +75,17 @@ do_start()
|
|||||||
#
|
#
|
||||||
do_stop()
|
do_stop()
|
||||||
{
|
{
|
||||||
# Return
|
# Return
|
||||||
# 0 if daemon has been stopped
|
# 0 if daemon has been stopped
|
||||||
# 1 if daemon was already stopped
|
# 1 if daemon was already stopped
|
||||||
# 2 if daemon could not be stopped
|
# 2 if daemon could not be stopped
|
||||||
# other if a failure occurred
|
# other if a failure occurred
|
||||||
|
|
||||||
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
|
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
# Many daemons don't delete their pidfiles when they exit.
|
# Many daemons don't delete their pidfiles when they exit.
|
||||||
rm -f $PIDFILE
|
rm -f $PIDFILE
|
||||||
return "$RETVAL"
|
return "$RETVAL"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -93,37 +93,37 @@ do_stop()
|
|||||||
#
|
#
|
||||||
do_restart()
|
do_restart()
|
||||||
{
|
{
|
||||||
# Return
|
# Return
|
||||||
# 0 if daemon was (re-)started
|
# 0 if daemon was (re-)started
|
||||||
# 1 if daemon was not strated or re-started
|
# 1 if daemon was not strated or re-started
|
||||||
|
|
||||||
do_stop
|
do_stop
|
||||||
case "$?" in
|
case "$?" in
|
||||||
0|1)
|
0|1)
|
||||||
do_start
|
do_start
|
||||||
case "$?" in
|
case "$?" in
|
||||||
0) RETVAL=0 ;;
|
0) RETVAL=0 ;;
|
||||||
1) RETVAL=1 ;; # Old process is still running
|
1) RETVAL=1 ;; # Old process is still running
|
||||||
*) RETVAL=1 ;; # Failed to start
|
*) RETVAL=1 ;; # Failed to start
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
*) RETVAL=1 ;; # Failed to stop
|
*) RETVAL=1 ;; # Failed to stop
|
||||||
esac
|
esac
|
||||||
|
|
||||||
return "$RETVAL"
|
return "$RETVAL"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Function that sends a SIGHUP to the daemon/service
|
# Function that sends a SIGHUP to the daemon/service
|
||||||
#
|
#
|
||||||
do_reload() {
|
do_reload() {
|
||||||
#
|
#
|
||||||
# If the daemon can reload its configuration without
|
# If the daemon can reload its configuration without
|
||||||
# restarting (for example, when it is sent a SIGHUP),
|
# restarting (for example, when it is sent a SIGHUP),
|
||||||
# then implement that here.
|
# then implement that here.
|
||||||
#
|
#
|
||||||
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE
|
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -131,79 +131,79 @@ do_reload() {
|
|||||||
#
|
#
|
||||||
do_status()
|
do_status()
|
||||||
{
|
{
|
||||||
# Return
|
# Return
|
||||||
# 0 if daemon is responding and OK
|
# 0 if daemon is responding and OK
|
||||||
# 1 if daemon is not responding, but PIDFILE exists
|
# 1 if daemon is not responding, but PIDFILE exists
|
||||||
# 2 if daemon is not responding, but LOCKFILE exists
|
# 2 if daemon is not responding, but LOCKFILE exists
|
||||||
# 3 if deamon is not running
|
# 3 if deamon is not running
|
||||||
# 4 if daemon status is unknown
|
# 4 if daemon status is unknown
|
||||||
|
|
||||||
# Check to see if the daemon is already running.
|
# Check to see if the daemon is already running.
|
||||||
start-stop-daemon --stop --test --quiet --pidfile $PIDFILE \
|
start-stop-daemon --stop --test --quiet --pidfile $PIDFILE \
|
||||||
&& return 0
|
&& return 0
|
||||||
[ -f $PIDFILE ] && return 1
|
[ -f $PIDFILE ] && return 1
|
||||||
return 3
|
return 3
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
|
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
|
||||||
do_start
|
do_start
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
[ "$VERBOSE" != no ] &&
|
[ "$VERBOSE" != no ] &&
|
||||||
case "$RETVAL" in
|
case "$RETVAL" in
|
||||||
0|1) log_end_msg 0 ;;
|
0|1) log_end_msg 0 ;;
|
||||||
*) log_end_msg 1 ;;
|
*) log_end_msg 1 ;;
|
||||||
esac
|
esac
|
||||||
exit "$RETVAL"
|
exit "$RETVAL"
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
||||||
do_stop
|
do_stop
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
[ "$VERBOSE" != no ] &&
|
[ "$VERBOSE" != no ] &&
|
||||||
case "$RETVAL" in
|
case "$RETVAL" in
|
||||||
0|1) log_end_msg 0 ;;
|
0|1) log_end_msg 0 ;;
|
||||||
*) log_end_msg 1 ;;
|
*) log_end_msg 1 ;;
|
||||||
esac
|
esac
|
||||||
exit "$RETVAL"
|
exit "$RETVAL"
|
||||||
;;
|
;;
|
||||||
#reload|force-reload)
|
#reload|force-reload)
|
||||||
#
|
#
|
||||||
# If do_reload() is not implemented then leave this commented out
|
# If do_reload() is not implemented then leave this commented out
|
||||||
# and leave 'force-reload' as an alias for 'restart'.
|
# and leave 'force-reload' as an alias for 'restart'.
|
||||||
#
|
#
|
||||||
#[ "$VERBOSE" != no ] && log_daemon_msg "Reloading $DESC" "$NAME"
|
#[ "$VERBOSE" != no ] && log_daemon_msg "Reloading $DESC" "$NAME"
|
||||||
#do_reload
|
#do_reload
|
||||||
#RETVAL=$?
|
#RETVAL=$?
|
||||||
#[ "$VERBOSE" != no ] && log_end_msg $?
|
#[ "$VERBOSE" != no ] && log_end_msg $?
|
||||||
#exit "$RETVAL"
|
#exit "$RETVAL"
|
||||||
#;;
|
#;;
|
||||||
restart|force-reload)
|
restart|force-reload)
|
||||||
#
|
#
|
||||||
# If the "reload" option is implemented then remove the
|
# If the "reload" option is implemented then remove the
|
||||||
# 'force-reload' alias
|
# 'force-reload' alias
|
||||||
#
|
#
|
||||||
[ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" "$NAME"
|
[ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" "$NAME"
|
||||||
do_restart
|
do_restart
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
[ "$VERBOSE" != no ] && log_end_msg "$RETVAL"
|
[ "$VERBOSE" != no ] && log_end_msg "$RETVAL"
|
||||||
exit "$RETVAL"
|
exit "$RETVAL"
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
do_status
|
do_status
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
[ "$VERBOSE" != no ] &&
|
[ "$VERBOSE" != no ] &&
|
||||||
case "$RETVAL" in
|
case "$RETVAL" in
|
||||||
0) log_success_msg "$NAME is running" ;;
|
0) log_success_msg "$NAME is running" ;;
|
||||||
*) log_failure_msg "$NAME is not running" ;;
|
*) log_failure_msg "$NAME is not running" ;;
|
||||||
esac
|
esac
|
||||||
exit "$RETVAL"
|
exit "$RETVAL"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
|
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
|
||||||
exit 3
|
exit 3
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
:
|
:
|
||||||
@@ -220,4 +220,3 @@ esac
|
|||||||
# http://refspecs.linux-foundation.org/LSB_3.2.0/LSB-Core-generic/LSB-Core-generic.pdf
|
# http://refspecs.linux-foundation.org/LSB_3.2.0/LSB-Core-generic/LSB-Core-generic.pdf
|
||||||
# Debian Policy SysV init: http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
|
# Debian Policy SysV init: http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
|
||||||
# Examine files in /usr/share/doc/sysv-rc/
|
# Examine files in /usr/share/doc/sysv-rc/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user