-
Notifications
You must be signed in to change notification settings - Fork 0
/
4-not_found_page_404
executable file
·41 lines (29 loc) · 1.13 KB
/
4-not_found_page_404
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
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
# Install Nginx web server
# Requirements:
#+ Install nginx on web-01 server.
#+ Nginx should be listening on port 80.
# Install/update Nginx
echo -e "Updating package lists..\n"
sudo apt-get -y update -qq
echo -e "Installing Nginx.. \n"
sudo apt-get -y install nginx
# Start Nginx service
sudo service nginx start
# Allows nginx on firewall
sudo ufw allow "Nginx HTTP"
# Change site file ownership and permissions to user for editing
sudo chown -R "$USER":"$USER" /var/www/html
sudo chown -R 755 /var/www
# Backup default index
cp /var/www/html/index.nginx-debian.html /var/www/html/index.nginx-debian.html.bckp
# Create new index
echo -e "Hello World!" | dd status=none of=/var/www/html/index.nginx-debian.html
# Setting up /redirect_me to my portfolio website
sudo sed -i '24i\ rewrite ^/redirect_me https://femiajanaku.vercel.app permanent;' /etc/nginx/sites-available/default
# Set up 404 page
echo "Ceci n'est pas une page" >> /var/www/html/error_404.html
sudo sed -i '25i\ error_page 404 /error_404.html;' /etc/nginx/sites-available/default
# Restart Nginx
sudo service nginx restart
echo -e "\nCompleted. ✅\n"