-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0-custom_http_response_header
More file actions
executable file
·30 lines (24 loc) · 1.03 KB
/
Copy path0-custom_http_response_header
File metadata and controls
executable file
·30 lines (24 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
# configures an Ubuntu machine with nginx
# FILE="/etc/nginx/sites-available/default"
# ERRORFILE="/usr/share/nginx/html/404error.html"
# REDIRECT="\n\tlocation /redirect_me {\n\t\treturn 301 https://youtu.be/dQw4w9WgXcQ;\n\t}\n"
# ERRORREDIRECT="\n\terror_page 404 /404error.html;\n\tlocation = /404error.html {\n\t\troot /usr/share/nginx/html;\n\t\tinternal;\n\t}\n"
# CUSTOMHEADER='\n\tadd_header X-Served-By $hostname;\n'
# STRING="Hello World!"
# FOUR="Ceci n'est pas une page"
# apt-get -y update
# apt-get -y install nginx
# ufw allow 'Nginx HTTP'
# echo "$STRING" > /var/www/html/index.nginx-debian.html
# sed -i "37i\ $REDIRECT" "$FILE"
# echo "$FOUR" > "$ERRORFILE"
# sed -i "37i\ $ERRORREDIRECT" "$FILE"
# sed -i "37i\ $CUSTOMHEADER" "$FILE"
# service nginx restart
sudo apt-get update
sudo apt-get -y install nginx
sudo service nginx start
sudo sed -i "/http {/a\ add_header X-Served-By $HOSTNAME;" /etc/nginx/nginx.conf
echo "Hello World!" | sudo tee /usr/share/nginx/html/index.html
sudo service nginx restart