32 lines
747 B
Bash
32 lines
747 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
|
||
|
if [[ $UID -ne 0 ]]; then
|
||
|
echo "This script must be run as root."
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
# Chemin relatif pour les cas où
|
||
|
# le script n'est pas exécuté depuis
|
||
|
# le répertoire où il se trouve.
|
||
|
rel_path="$(dirname "$0")"
|
||
|
|
||
|
# Fichiers requis pour le script
|
||
|
files=('dhparam.txt' 'nginx.conf' 'reverse-proxy.conf')
|
||
|
for file in "${files[@]}"; do
|
||
|
if ! [[ -f "$rel_path/$file" ]]; then
|
||
|
echo "Required file $file is missing, exiting."
|
||
|
exit 1
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
|
||
|
cp "$rel_path/nginx.conf" /etc/nginx/
|
||
|
cp "$rel_path/reverse-proxy.conf" /etc/nginx/sites-available/
|
||
|
cp "$rel_path/dhparam.txt" /etc/nginx/
|
||
|
|
||
|
rm /etc/nginx/sites-enabled/*
|
||
|
ln -s /etc/nginx/sites-available/reverse-proxy.conf /etc/nginx/sites-enabled/reverse-proxy.conf
|
||
|
|
||
|
systemctl reload nginx
|