From f480a0b9681c1e24313d92d4b761b22d843af98a Mon Sep 17 00:00:00 2001 From: the1Riddle Date: Mon, 18 Dec 2023 14:40:27 +0300 Subject: [PATCH] this is awesome --- .../0-custom_http_response_header | 27 +++++++++++++++++++ 0x0F-load_balancer/1-install_load_balancer | 0 2 files changed, 27 insertions(+) create mode 100755 0x0F-load_balancer/0-custom_http_response_header mode change 100644 => 100755 0x0F-load_balancer/1-install_load_balancer diff --git a/0x0F-load_balancer/0-custom_http_response_header b/0x0F-load_balancer/0-custom_http_response_header new file mode 100755 index 0000000..d3365b1 --- /dev/null +++ b/0x0F-load_balancer/0-custom_http_response_header @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +# configure web-02 to be identical to web-01 + +sudo apt-get -y update +sudo apt install -y nginx +sudo ufw allow 'Nginx HTTP' +echo "Hello World" | sudo tee /var/www/html/index.html +echo "Ceci n'est pas une page" > 404.html +sudo mv 404.html /var/www/html +echo "server { + listen 80 default_server; + listen [::]:80 default_server; + add_header X-Served-By $HOSTNAME; + root /var/www/html; + index index.html; + location /redirect_me { + return 301 https://github.com/the1Riddle + } + + error_page 404 /404.html; + location = /404.html{ + internal; + } +}" > default + +sudo mv -f default /etc/nginx/sites-available/default +sudo service nginx restart diff --git a/0x0F-load_balancer/1-install_load_balancer b/0x0F-load_balancer/1-install_load_balancer old mode 100644 new mode 100755