Use proxy_pass

This commit is contained in:
Bob Mottram 2016-11-16 12:32:50 +00:00
parent ef4dd4fa38
commit cce5157221
1 changed files with 37 additions and 32 deletions

View File

@ -226,7 +226,11 @@ function install_radicale {
fi fi
chown www-data:www-data ${RADICALE_DIRECTORY}/collections chown www-data:www-data ${RADICALE_DIRECTORY}/collections
echo '[auth]' > ${RADICALE_DIRECTORY}/config echo '[server]' > ${RADICALE_DIRECTORY}/config
echo 'hosts=127.0.0.1:52322' >> ${RADICALE_DIRECTORY}/config
echo 'ssl = False' >> ${RADICALE_DIRECTORY}/config
echo '' >> ${RADICALE_DIRECTORY}/config
echo '[auth]' >> ${RADICALE_DIRECTORY}/config
echo 'type = htpasswd' >> ${RADICALE_DIRECTORY}/config echo 'type = htpasswd' >> ${RADICALE_DIRECTORY}/config
echo "htpasswd_filename = ${RADICALE_DIRECTORY}/users" >> ${RADICALE_DIRECTORY}/config echo "htpasswd_filename = ${RADICALE_DIRECTORY}/users" >> ${RADICALE_DIRECTORY}/config
echo 'htpasswd_encryption = bcrypt' >> ${RADICALE_DIRECTORY}/config echo 'htpasswd_encryption = bcrypt' >> ${RADICALE_DIRECTORY}/config
@ -254,38 +258,38 @@ function install_radicale {
echo 'radicale.log.start()' >> /var/www/radicale/radicale.py echo 'radicale.log.start()' >> /var/www/radicale/radicale.py
echo 'application = radicale.Application()' >> /var/www/radicale/radicale.py echo 'application = radicale.Application()' >> /var/www/radicale/radicale.py
echo '[uwsgi]' > /var/www/radicale/uwsgi.ini #echo '[uwsgi]' > /var/www/radicale/uwsgi.ini
echo 'plugins = python' >> /var/www/radicale/uwsgi.ini #echo 'plugins = python' >> /var/www/radicale/uwsgi.ini
echo 'socket = /var/run/uwsgi/radicale.sock' >> /var/www/radicale/uwsgi.ini #echo 'socket = /var/run/uwsgi/radicale.sock' >> /var/www/radicale/uwsgi.ini
echo 'chmod-socket = 660' >> /var/www/radicale/uwsgi.ini #echo 'chmod-socket = 660' >> /var/www/radicale/uwsgi.ini
echo '' >> /var/www/radicale/uwsgi.ini #echo '' >> /var/www/radicale/uwsgi.ini
echo 'wsgi-file = /var/www/radicale/radicale.py' >> /var/www/radicale/uwsgi.ini #echo 'wsgi-file = /var/www/radicale/radicale.py' >> /var/www/radicale/uwsgi.ini
echo 'master' >> /var/www/radicale/uwsgi.ini #echo 'master' >> /var/www/radicale/uwsgi.ini
echo 'workers = 1' >> /var/www/radicale/uwsgi.ini #echo 'workers = 1' >> /var/www/radicale/uwsgi.ini
echo 'max-requests = 100' >> /var/www/radicale/uwsgi.ini #echo 'max-requests = 100' >> /var/www/radicale/uwsgi.ini
echo 'harakiri = 30' >> /var/www/radicale/uwsgi.ini #echo 'harakiri = 30' >> /var/www/radicale/uwsgi.ini
echo 'die-on-term' >> /var/www/radicale/uwsgi.ini #echo 'die-on-term' >> /var/www/radicale/uwsgi.ini
echo '#!/bin/sh' > /usr/local/bin/uwsgi_rundir.sh #echo '#!/bin/sh' > /usr/local/bin/uwsgi_rundir.sh
echo 'mkdir -p /var/run/uwsgi' >> /usr/local/bin/uwsgi_rundir.sh #echo 'mkdir -p /var/run/uwsgi' >> /usr/local/bin/uwsgi_rundir.sh
echo 'chown www-data:www-data /var/run/uwsgi' >> /usr/local/bin/uwsgi_rundir.sh #echo 'chown www-data:www-data /var/run/uwsgi' >> /usr/local/bin/uwsgi_rundir.sh
chmod +x /usr/local/bin/uwsgi_rundir.sh #chmod +x /usr/local/bin/uwsgi_rundir.sh
echo '[Unit]' > /etc/systemd/system/uwsgi_rundir.service #echo '[Unit]' > /etc/systemd/system/uwsgi_rundir.service
echo 'Description=UWSGI socket directory' >> /etc/systemd/system/uwsgi_rundir.service #echo 'Description=UWSGI socket directory' >> /etc/systemd/system/uwsgi_rundir.service
echo 'After=network.target' >> /etc/systemd/system/uwsgi_rundir.service #echo 'After=network.target' >> /etc/systemd/system/uwsgi_rundir.service
echo '' >> /etc/systemd/system/uwsgi_rundir.service #echo '' >> /etc/systemd/system/uwsgi_rundir.service
echo '[Service]' >> /etc/systemd/system/uwsgi_rundir.service #echo '[Service]' >> /etc/systemd/system/uwsgi_rundir.service
echo 'Type=simple' >> /etc/systemd/system/uwsgi_rundir.service #echo 'Type=simple' >> /etc/systemd/system/uwsgi_rundir.service
echo 'User=root' >> /etc/systemd/system/uwsgi_rundir.service #echo 'User=root' >> /etc/systemd/system/uwsgi_rundir.service
echo 'ExecStart=/usr/local/bin/uwsgi_rundir.sh' >> /etc/systemd/system/uwsgi_rundir.service #echo 'ExecStart=/usr/local/bin/uwsgi_rundir.sh' >> /etc/systemd/system/uwsgi_rundir.service
echo '' >> /etc/systemd/system/uwsgi_rundir.service #echo '' >> /etc/systemd/system/uwsgi_rundir.service
echo '[Install]' >> /etc/systemd/system/uwsgi_rundir.service #echo '[Install]' >> /etc/systemd/system/uwsgi_rundir.service
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/uwsgi_rundir.service #echo 'WantedBy=multi-user.target' >> /etc/systemd/system/uwsgi_rundir.service
systemctl enable uwsgi_rundir #systemctl enable uwsgi_rundir
echo '[Unit]' > /etc/systemd/system/radicale.service echo '[Unit]' > /etc/systemd/system/radicale.service
echo 'Description=Start uwsgi for radicale' >> /etc/systemd/system/radicale.service echo 'Description=Radicale CalDAV Server' >> /etc/systemd/system/radicale.service
echo 'After=network.target' >> /etc/systemd/system/radicale.service echo 'After=network.target' >> /etc/systemd/system/radicale.service
echo 'Requires=uwsgi_rundir.service' >> /etc/systemd/system/radicale.service echo 'Requires=uwsgi_rundir.service' >> /etc/systemd/system/radicale.service
echo '' >> /etc/systemd/system/radicale.service echo '' >> /etc/systemd/system/radicale.service
@ -293,7 +297,7 @@ function install_radicale {
echo 'Type=simple' >> /etc/systemd/system/radicale.service echo 'Type=simple' >> /etc/systemd/system/radicale.service
echo 'User=www-data' >> /etc/systemd/system/radicale.service echo 'User=www-data' >> /etc/systemd/system/radicale.service
echo 'Group=www-data' >> /etc/systemd/system/radicale.service echo 'Group=www-data' >> /etc/systemd/system/radicale.service
echo 'ExecStart=/usr/bin/uwsgi --ini /var/www/radicale/uwsgi.ini' >> /etc/systemd/system/radicale.service echo 'ExecStart=/var/www/radicale/radicale.py' >> /etc/systemd/system/radicale.service
echo '' >> /etc/systemd/system/radicale.service echo '' >> /etc/systemd/system/radicale.service
echo '[Install]' >> /etc/systemd/system/radicale.service echo '[Install]' >> /etc/systemd/system/radicale.service
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/radicale.service echo 'WantedBy=multi-user.target' >> /etc/systemd/system/radicale.service
@ -336,8 +340,9 @@ function install_radicale {
echo ' error_log /var/log/radicale/radicale.log warn;' >> /etc/nginx/sites-available/radicale echo ' error_log /var/log/radicale/radicale.log warn;' >> /etc/nginx/sites-available/radicale
echo '' >> /etc/nginx/sites-available/radicale echo '' >> /etc/nginx/sites-available/radicale
echo ' location / {' >> /etc/nginx/sites-available/radicale echo ' location / {' >> /etc/nginx/sites-available/radicale
echo ' uwsgi_pass unix:/var/run/uwsgi/radicale.sock;' >> /etc/nginx/sites-available/radicale echo ' proxy_pass http://localhost:52322;' >> /etc/nginx/sites-available/radicale
echo ' include uwsgi_params;' >> /etc/nginx/sites-available/radicale #echo ' uwsgi_pass unix:/var/run/uwsgi/radicale.sock;' >> /etc/nginx/sites-available/radicale
#echo ' include uwsgi_params;' >> /etc/nginx/sites-available/radicale
echo ' }' >> /etc/nginx/sites-available/radicale echo ' }' >> /etc/nginx/sites-available/radicale
echo '}' >> /etc/nginx/sites-available/radicale echo '}' >> /etc/nginx/sites-available/radicale