Merge branch '5-improve-certificate-acquistion' into 'master'
Resolve "improve certificate acquistion" Closes #5 See merge request lhprojects-information-network/scripts!4
This commit is contained in:
commit
8736baabbe
1 changed files with 12 additions and 18 deletions
|
@ -25,19 +25,9 @@ function usage
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
function stop_nginx
|
|
||||||
{
|
|
||||||
systemctl stop nginx
|
|
||||||
}
|
|
||||||
|
|
||||||
function start_nginx
|
|
||||||
{
|
|
||||||
systemctl start nginx
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_cert
|
function get_cert
|
||||||
{
|
{
|
||||||
/root/.acme.sh/acme.sh --issue --domain $_domain --standalone --cert-file /etc/nginx/ssl/${_domain}.crt --key-file /etc/nginx/ssl/${_domain}.key --fullchain-file /etc/nginx/ssl/${_domain}-fullchain.crt
|
/root/.acme.sh/acme.sh --issue --domain $_domain --webroot /srv/http-content-combined/ --cert-file /etc/nginx/ssl/${_domain}.crt --key-file /etc/nginx/ssl/${_domain}.key --fullchain-file /etc/nginx/ssl/${_domain}-fullchain.crt
|
||||||
}
|
}
|
||||||
|
|
||||||
_cwd="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
_cwd="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
@ -124,6 +114,15 @@ fi
|
||||||
echo "Creating Nginx configuration..."
|
echo "Creating Nginx configuration..."
|
||||||
_vhost_conf_file=/etc/nginx/conf.d/${_domain}.conf
|
_vhost_conf_file=/etc/nginx/conf.d/${_domain}.conf
|
||||||
|
|
||||||
|
|
||||||
|
echo -n "Checking if /srv/http-content-combined/ exists?"
|
||||||
|
if ! test -d /srv/http-content-combined; then
|
||||||
|
echo " Creating..."
|
||||||
|
mkdir -p /srv/http-content-combined/
|
||||||
|
else
|
||||||
|
echo " Yes!"
|
||||||
|
fi
|
||||||
|
|
||||||
cat << EOF > $_vhost_conf_file
|
cat << EOF > $_vhost_conf_file
|
||||||
#### Description
|
#### Description
|
||||||
## Type: HTTP
|
## Type: HTTP
|
||||||
|
@ -134,6 +133,7 @@ server {
|
||||||
server_name $_domain;
|
server_name $_domain;
|
||||||
|
|
||||||
location /.well-known {
|
location /.well-known {
|
||||||
|
root /srv/http-content-combined/;
|
||||||
autoindex on;
|
autoindex on;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,11 +162,5 @@ EOF
|
||||||
echo "Setting permissions on conf file..."
|
echo "Setting permissions on conf file..."
|
||||||
#setfacl -m user:sysadmin:rw $_vhost_conf_file
|
#setfacl -m user:sysadmin:rw $_vhost_conf_file
|
||||||
|
|
||||||
echo "Stopping Nginx..."
|
|
||||||
#stop_nginx
|
|
||||||
|
|
||||||
echo "Retrieving Let's Encrypt Certificate..."
|
echo "Retrieving Let's Encrypt Certificate..."
|
||||||
#get_cert
|
get_cert
|
||||||
|
|
||||||
echo "Starting Nginx..."
|
|
||||||
#start_nginx
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue