-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.sh
62 lines (52 loc) · 1.28 KB
/
nginx.sh
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
sudo apt update -y
sudo apt install nginx -y
sudo systemctl enable --now nginx.service
instanceId=$(TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` \
&& curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/instance-id)
region=$(TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` \
&& curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/public-ipv4)
echo "*{
padding:0;
margin:0;
}
table{
table-layout:fixed;
width:100%;
border-collapse:collapse;
}
table, th,td{
border: 1px solid rgb(220,220,220);
}
table th{
background-color: rgb(104, 208, 109);
}
table td{
text-align:center;
}
" > /var/www/html/styles.css
echo "<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title>Document</title>
</head>
<body>
<h1>Table</h1>
<div class="table">
<table>
<tr>
<th>InstanceId</th>
<th>Region</th>
</tr>
<tr>
<td>$instanceId</td>
<td>$region</td>
</tr>
</table>
</div>
</body>
</html>
" > /var/www/html/index.html