#!/bin/bash #--------------------------------------------------------- # Script Install Tryton uswgi for Home Intance # -------------------------------------------------------- #--------------------------------------------------------- # Fill this variables before run script # # domain=domain # port=8000 # user=psk # # # #--------------------------------------------------------- if ! [ -x "$(command -v nginx)" ]; then sudo apt update sudo apt -y install nginx >&2 echo "nginx is installed" fi mkdir /etc/uwsgi mkdir /etc/uwsgi/vassals file_location=/etc/uwsgi/vassals/trytond.ini if [ -f "$file_location" ]; then echo "File $file_location already exists!" else cat > $file_location < $file_location2 < $file_location3 </static; # your Django project's static files - amend as required #} error_page 497 301 =307 https://${domain}:${port}$request_uri; # Finally, send all non-media requests. location / { add_header 'Access-Control-Allow-Origin' '*'; include uwsgi_params; # the uwsgi_params file you installed uwsgi_param REMOTE_USER '$remote_user'; uwsgi_param DATE_GMT '$date_gmt'; uwsgi_param DATE_LOCAL '$date_local'; uwsgi_param AUTH_TYPE Basic; uwsgi_read_timeout 600s; uwsgi_pass trytond; } location /status_server { stub_status on; allow 127.0.0.1; deny all; } listen [::]:${port} ssl ipv6only=on; # managed by Certbot listen ${port} ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/${domain}/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/${domain}/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot #ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #ssl_ciphers HIGH:!aNULL:!MD5; } EOF fi ln -s /etc/nginx/sites-available/trytond /etc/nginx/sites-enabled/ ufw allow 'Nginx Full' ufw allow 8000 ufw reload systemctl enable uwtrytond.service systemctl start uwtrytond.service systemctl stop nginx systemctl start nginx