Script added
This commit is contained in:
parent
a8addbec49
commit
1588f31e88
2 changed files with 21 additions and 5 deletions
|
|
@ -6,13 +6,13 @@
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name meshpi.local 192.168.1.8;
|
server_name DOMAIN IPADDR;
|
||||||
return 301 https://$host$request_uri;
|
return 301 https://$host$request_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
server_name meshpi.local 192.168.1.8;
|
server_name DOMAIN IPADDR;
|
||||||
|
|
||||||
ssl_certificate /etc/nginx/ssl/meshpi.crt;
|
ssl_certificate /etc/nginx/ssl/meshpi.crt;
|
||||||
ssl_certificate_key /etc/nginx/ssl/meshpi.key;
|
ssl_certificate_key /etc/nginx/ssl/meshpi.key;
|
||||||
|
|
@ -13,6 +13,8 @@ pkgs="openssl nginx"
|
||||||
|
|
||||||
echo -e "\n${CYN} Dependency and Privilege Check running...${CRS}\n"
|
echo -e "\n${CYN} Dependency and Privilege Check running...${CRS}\n"
|
||||||
|
|
||||||
|
### PRIVILEGES
|
||||||
|
|
||||||
if (( $(id -u) == 0 )); then
|
if (( $(id -u) == 0 )); then
|
||||||
echo -e "${GRN} Privilege check passed...${CRS}\n"
|
echo -e "${GRN} Privilege check passed...${CRS}\n"
|
||||||
|
|
||||||
|
|
@ -21,6 +23,8 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
### DEPENDENCIES
|
||||||
|
|
||||||
if command -v "$pkgs" >/dev/null 2>&1; then
|
if command -v "$pkgs" >/dev/null 2>&1; then
|
||||||
echo -e "${GRN} Dependency check passed...${CRS}\n"
|
echo -e "${GRN} Dependency check passed...${CRS}\n"
|
||||||
|
|
||||||
|
|
@ -45,12 +49,18 @@ else
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### NGINX SETUP
|
### NGINX SETUP & CONFIG
|
||||||
|
|
||||||
#### CERTIFICATION
|
###### DOMAIN & IP
|
||||||
|
|
||||||
|
# ask for network interface & get IP
|
||||||
|
# get hostname from /etc/hostname
|
||||||
|
# ask to change hostname in /etc/hosts & /etc/hostname
|
||||||
|
|
||||||
|
###### CERTIFICATION
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
read -p " Enable SSL and create self signed cetrificate? (Y/n) : " installSSL
|
read -p " Configure SSL and create a self signed cetrificate? (Y/n) : " installSSL
|
||||||
if [[ "$installSSL" = "" || "$installSSL" = "y" || "$installSSL" = "Y" ]]; then
|
if [[ "$installSSL" = "" || "$installSSL" = "y" || "$installSSL" = "Y" ]]; then
|
||||||
read -p " Enter path to certificates folder (Will be created if not present) : " cert_path
|
read -p " Enter path to certificates folder (Will be created if not present) : " cert_path
|
||||||
echo ""
|
echo ""
|
||||||
|
|
@ -58,6 +68,12 @@ while true; do
|
||||||
echo ""
|
echo ""
|
||||||
sudo mkdir -p "$cert_path"
|
sudo mkdir -p "$cert_path"
|
||||||
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout "$cert_path"/"$cert_name".key -out "$cert_path"/"$cert_name".crt
|
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout "$cert_path"/"$cert_name".key -out "$cert_path"/"$cert_name".crt
|
||||||
|
#sudo cp -R assets/config/nginx/nginx.conf /etc/nginx/sites-enabled/
|
||||||
|
## JEFF
|
||||||
|
# utilise sed to edit config
|
||||||
|
# test nginx config
|
||||||
|
# restart nginx
|
||||||
|
## JEFF END
|
||||||
echo -e "\n${GRN} Nginx configured${CRS}\n"
|
echo -e "\n${GRN} Nginx configured${CRS}\n"
|
||||||
break
|
break
|
||||||
elif [[ "$installSSL" == "n" || "$installSSL" = "N" ]]; then
|
elif [[ "$installSSL" == "n" || "$installSSL" = "N" ]]; then
|
||||||
Loading…
Add table
Add a link
Reference in a new issue