2022-01-18 09:49:08 +01:00
|
|
|
#!/bin/bash
|
2022-01-23 13:41:11 +01:00
|
|
|
|
|
|
|
if [ -f /etc/nginx/certs/default.crt ]; then
|
|
|
|
rm -rf /etc/nginx/certs/default.key || true
|
|
|
|
rm -rf /etc/nginx/certs/default.crt || true
|
|
|
|
fi
|
2022-01-18 09:49:08 +01:00
|
|
|
|
|
|
|
# Generate a self-signed certificate if one doesn't exist in the certs path.
|
2022-01-23 13:41:11 +01:00
|
|
|
if [ ! -f /etc/nginx/certs/default.crt ]; then
|
2022-01-18 09:49:08 +01:00
|
|
|
echo "Generating self-signed certificate..."
|
|
|
|
|
|
|
|
openssl req -new -nodes -x509 -subj "/C=US/ST=Texas/L=Austin/O=IT/CN=localhost" \
|
|
|
|
-days 365 -extensions v3_ca \
|
|
|
|
-keyout /etc/nginx/certs/default.key \
|
|
|
|
-out /etc/nginx/certs/default.crt
|
|
|
|
fi
|