better setup-web2py-nginx-uwsgi-ubuntu.sh, issue 816, thanks Orsomannaro

This commit is contained in:
Massimo DiPierro
2012-05-21 16:50:03 -05:00
parent 3f18d032e9
commit ba6ba5342a
2 changed files with 80 additions and 82 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.00.0 (2012-05-21 10:08:41) dev Version 2.00.0 (2012-05-21 16:49:59) dev
+13 -15
View File
@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
echo 'setup-web2py-nginx-uwsgi-ubuntu.sh' echo 'setup-web2py-nginx-uwsgi-ubuntu-precise.sh'
echo 'Requires Ubuntu 10.04 (LTS) and installs Nginx + uWSGI + Web2py' echo 'Requires Ubuntu 12.04 and installs Nginx + uWSGI + Web2py'
# Get Web2py Admin Password # Get Web2py Admin Password
echo -e "Web2py Admin Password: \c " echo -e "Web2py Admin Password: \c "
@@ -10,12 +10,11 @@ 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 install python-software-properties apt-get -y dist-upgrade
add-apt-repository ppa:nginx/stable apt-get autoremove
add-apt-repository ppa:uwsgi/release apt-get autoclean
apt-get update
apt-get -y install nginx-full apt-get -y install nginx-full
apt-get -y install uwsgi-python apt-get -y install uwsgi uwsgi-plugin-python
# Create configuration file /etc/nginx/sites-available/web2py # Create configuration file /etc/nginx/sites-available/web2py
echo 'server { echo 'server {
@@ -49,33 +48,32 @@ server {
ln -s /etc/nginx/sites-available/web2py /etc/nginx/sites-enabled/web2py ln -s /etc/nginx/sites-available/web2py /etc/nginx/sites-enabled/web2py
rm /etc/nginx/sites-enabled/default rm /etc/nginx/sites-enabled/default
rm /etc/nginx/sites-available/default
mkdir /etc/nginx/ssl mkdir /etc/nginx/ssl
cd /etc/nginx/ssl cd /etc/nginx/ssl
openssl genrsa -out web2py.key 1024 openssl genrsa -out web2py.key 1024
openssl req -batch -new -key web2py.key -out web2py.csr openssl req -batch -new -key web2py.key -out web2py.csr
openssl x509 -req -days 1780 -in web2py.csr -signkey web2py.key -out web2py.crt openssl x509 -req -days 1780 -in web2py.csr -signkey web2py.key -out web2py.crt
# Create configuration file /etc/uwsgi-python/apps-available/web2py.xml # Create configuration file /etc/uwsgi/apps-available/web2py.xml
echo '<uwsgi> echo '<uwsgi>
<plugin>python</plugin>
<socket>127.0.0.1:9001</socket> <socket>127.0.0.1:9001</socket>
<pythonpath>/home/www-data/web2py/</pythonpath> <pythonpath>/home/www-data/web2py/</pythonpath>
<app mountpoint="/"> <app mountpoint="/">
<script>wsgihandler</script> <script>wsgihandler</script>
</app> </app>
</uwsgi>' >/etc/uwsgi-python/apps-available/web2py.xml </uwsgi>' >/etc/uwsgi/apps-available/web2py.xml
ln -s /etc/uwsgi-python/apps-available/web2py.xml /etc/uwsgi-python/apps-enabled/web2py.xml ln -s /etc/uwsgi/apps-available/web2py.xml /etc/uwsgi/apps-enabled/web2py.xml
# Install Web2py # Install Web2py
apt-get -y install unzip apt-get -y install unzip
cd /home mkdir /home/www-data
mkdir www-data cd /home/www-data
cd www-data
wget http://web2py.com/examples/static/web2py_src.zip wget http://web2py.com/examples/static/web2py_src.zip
unzip web2py_src.zip unzip web2py_src.zip
rm web2py_src.zip rm web2py_src.zip
chown -R www-data:www-data web2py chown -R www-data:www-data web2py
cd /home/www-data/web2py cd /home/www-data/web2py
sudo -u www-data python -c "from gluon.main import save_password; save_password('$PW',443)" sudo -u www-data python -c "from gluon.main import save_password; save_password('$PW',443)"
/etc/init.d/uwsgi-python restart /etc/init.d/uwsgi restart
/etc/init.d/nginx restart /etc/init.d/nginx restart