First commit

This commit is contained in:
Myve 2024-06-14 07:14:42 +00:00
commit 2a57f40199
3 changed files with 88 additions and 0 deletions

43
nginx.sh Normal file
View file

@ -0,0 +1,43 @@
#!/usr/bin/env bash
# Fill in the following variables
appname=
url=
domain=
port=
eff_email_address=
# .conf installation
{
# Exit if variables are null
if [ -z ${appname} ] || [ -z ${url} ] || [ -z ${domain} ] || [ -z ${port} ] || [ -z ${eff_email_address} ]
then
exit 1
fi
sudo tee /etc/nginx/sites-available/${appname}.conf >/dev/null <<conf
server {
server_name ${url};
include local/http_upgrade;
location / {
proxy_pass http://${domain}:${port};
include local/proxy_params;
error_log /var/log/nginx/${appname}_error.log;
access_log /var/log/nginx/${appname}_access.log;
}
}
conf
sudo ln -s -f /etc/nginx/sites-available/${appname}.conf /etc/nginx/sites-enabled/
if sudo nginx -t
then
sudo systemctl reload nginx.service
sudo certbot --nginx --non-interactive --agree-tos --no-eff-email -m ${eff_email_address} -d ${url} \
--staple-ocsp --hsts --no-redirect
fi
}