-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetupNginx.bash
More file actions
53 lines (44 loc) · 1.12 KB
/
Copy pathsetupNginx.bash
File metadata and controls
53 lines (44 loc) · 1.12 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!bin/bash
echo "Enter the config name"
read confName
echo "Enter Domain name"
read domain
echo "Enter Port"
read port
v="$(cat <<-EOF
server {
listen 80;
server_name www.$domain;
gzip on;
gzip_proxied any;
gzip_types application/javascript application/x-javascript text/css text/javascript;
gzip_comp_level 5;
gzip_buffers 16 8k;
gzip_min_length 256;
location / {
proxy_pass http://127.0.0.1:$port;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host \$host;
proxy_cache_bypass \$http_upgrade;
}
}
server {
listen 80;
server_name $domain;
return 301 \$scheme://www.$domain\$request_uri;
}
server {
listen 443;
server_name $domain;
return 301 \$scheme://www.$domain\$request_uri;
}
EOF
)"
echo "Creating conf file"
echo "$v" > /etc/nginx/sites-available/$confName
echo "Checking nginx config"
sudo nginx -t
echo "Nginx Restarting"
sudo systemctl reload nginx