fixed scripts/setup-web2py-nginx-uwsgi-ubuntu.sh \r
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.00.0 (2012-08-24 15:33:59) dev
|
Version 2.00.0 (2012-08-24 15:53:07) dev
|
||||||
|
|||||||
@@ -315,3 +315,4 @@ reboot
|
|||||||
as superuser
|
as superuser
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,79 +1,78 @@
|
|||||||
#!/bin/bash
|
echo 'setup-web2py-nginx-uwsgi-ubuntu-precise.sh'
|
||||||
|
echo 'Requires Ubuntu 12.04 and installs Nginx + uWSGI + Web2py'
|
||||||
echo 'setup-web2py-nginx-uwsgi-ubuntu-precise.sh'
|
|
||||||
echo 'Requires Ubuntu 12.04 and installs Nginx + uWSGI + Web2py'
|
# Get Web2py Admin Password
|
||||||
|
echo -e "Web2py Admin Password: \c "
|
||||||
# Get Web2py Admin Password
|
read PW
|
||||||
echo -e "Web2py Admin Password: \c "
|
|
||||||
read PW
|
# Upgrade and install needed software
|
||||||
|
apt-get update
|
||||||
# Upgrade and install needed software
|
apt-get -y upgrade
|
||||||
apt-get update
|
apt-get -y dist-upgrade
|
||||||
apt-get -y upgrade
|
apt-get autoremove
|
||||||
apt-get -y dist-upgrade
|
apt-get autoclean
|
||||||
apt-get autoremove
|
apt-get -y install nginx-full
|
||||||
apt-get autoclean
|
apt-get -y install uwsgi uwsgi-plugin-python
|
||||||
apt-get -y install nginx-full
|
|
||||||
apt-get -y install uwsgi uwsgi-plugin-python
|
# Create configuration file /etc/nginx/sites-available/web2py
|
||||||
|
echo 'server {
|
||||||
# Create configuration file /etc/nginx/sites-available/web2py
|
listen 80;
|
||||||
echo 'server {
|
server_name $hostname;
|
||||||
listen 80;
|
location ~* /(\w+)/static/ {
|
||||||
server_name $hostname;
|
root /home/www-data/web2py/applications/;
|
||||||
location ~* /(\w+)/static/ {
|
}
|
||||||
root /home/www-data/web2py/applications/;
|
location / {
|
||||||
}
|
uwsgi_pass 127.0.0.1:9001;
|
||||||
location / {
|
include uwsgi_params;
|
||||||
uwsgi_pass 127.0.0.1:9001;
|
uwsgi_param UWSGI_SCHEME $scheme;
|
||||||
include uwsgi_params;
|
uwsgi_param SERVER_SOFTWARE nginx/$nginx_version;
|
||||||
uwsgi_param UWSGI_SCHEME $scheme;
|
}
|
||||||
uwsgi_param SERVER_SOFTWARE nginx/$nginx_version;
|
}
|
||||||
}
|
|
||||||
}
|
server {
|
||||||
|
listen 443;
|
||||||
server {
|
server_name $hostname;
|
||||||
listen 443;
|
ssl on;
|
||||||
server_name $hostname;
|
ssl_certificate /etc/nginx/ssl/web2py.crt;
|
||||||
ssl on;
|
ssl_certificate_key /etc/nginx/ssl/web2py.key;
|
||||||
ssl_certificate /etc/nginx/ssl/web2py.crt;
|
location / {
|
||||||
ssl_certificate_key /etc/nginx/ssl/web2py.key;
|
uwsgi_pass 127.0.0.1:9001;
|
||||||
location / {
|
include uwsgi_params;
|
||||||
uwsgi_pass 127.0.0.1:9001;
|
uwsgi_param UWSGI_SCHEME $scheme;
|
||||||
include uwsgi_params;
|
uwsgi_param SERVER_SOFTWARE nginx/$nginx_version;
|
||||||
uwsgi_param UWSGI_SCHEME $scheme;
|
}
|
||||||
uwsgi_param SERVER_SOFTWARE nginx/$nginx_version;
|
|
||||||
}
|
}' >/etc/nginx/sites-available/web2py
|
||||||
|
|
||||||
}' >/etc/nginx/sites-available/web2py
|
ln -s /etc/nginx/sites-available/web2py /etc/nginx/sites-enabled/web2py
|
||||||
|
rm /etc/nginx/sites-enabled/default
|
||||||
ln -s /etc/nginx/sites-available/web2py /etc/nginx/sites-enabled/web2py
|
mkdir /etc/nginx/ssl
|
||||||
rm /etc/nginx/sites-enabled/default
|
cd /etc/nginx/ssl
|
||||||
mkdir /etc/nginx/ssl
|
openssl genrsa -out web2py.key 1024
|
||||||
cd /etc/nginx/ssl
|
openssl req -batch -new -key web2py.key -out web2py.csr
|
||||||
openssl genrsa -out web2py.key 1024
|
openssl x509 -req -days 1780 -in web2py.csr -signkey web2py.key -out web2py.crt
|
||||||
openssl req -batch -new -key web2py.key -out web2py.csr
|
|
||||||
openssl x509 -req -days 1780 -in web2py.csr -signkey web2py.key -out web2py.crt
|
# Create configuration file /etc/uwsgi/apps-available/web2py.xml
|
||||||
|
echo '<uwsgi>
|
||||||
# Create configuration file /etc/uwsgi/apps-available/web2py.xml
|
<plugin>python</plugin>
|
||||||
echo '<uwsgi>
|
<socket>127.0.0.1:9001</socket>
|
||||||
<plugin>python</plugin>
|
<pythonpath>/home/www-data/web2py/</pythonpath>
|
||||||
<socket>127.0.0.1:9001</socket>
|
<app mountpoint="/">
|
||||||
<pythonpath>/home/www-data/web2py/</pythonpath>
|
<script>wsgihandler</script>
|
||||||
<app mountpoint="/">
|
</app>
|
||||||
<script>wsgihandler</script>
|
</uwsgi>' >/etc/uwsgi/apps-available/web2py.xml
|
||||||
</app>
|
ln -s /etc/uwsgi/apps-available/web2py.xml /etc/uwsgi/apps-enabled/web2py.xml
|
||||||
</uwsgi>' >/etc/uwsgi/apps-available/web2py.xml
|
|
||||||
ln -s /etc/uwsgi/apps-available/web2py.xml /etc/uwsgi/apps-enabled/web2py.xml
|
# Install Web2py
|
||||||
|
apt-get -y install unzip
|
||||||
# Install Web2py
|
mkdir /home/www-data
|
||||||
apt-get -y install unzip
|
cd /home/www-data
|
||||||
mkdir /home/www-data
|
wget http://web2py.com/examples/static/web2py_src.zip
|
||||||
cd /home/www-data
|
unzip web2py_src.zip
|
||||||
wget http://web2py.com/examples/static/web2py_src.zip
|
rm web2py_src.zip
|
||||||
unzip web2py_src.zip
|
chown -R www-data:www-data web2py
|
||||||
rm web2py_src.zip
|
cd /home/www-data/web2py
|
||||||
chown -R www-data:www-data web2py
|
sudo -u www-data python -c "from gluon.main import save_password; save_password('$PW',443)"
|
||||||
cd /home/www-data/web2py
|
/etc/init.d/uwsgi restart
|
||||||
sudo -u www-data python -c "from gluon.main import save_password; save_password('$PW',443)"
|
/etc/init.d/nginx restart
|
||||||
/etc/init.d/uwsgi restart
|
|
||||||
/etc/init.d/nginx restart
|
|
||||||
|
|||||||
Reference in New Issue
Block a user