blob: ac9ca1c06e83464f42db55cc4c571f920492ffc7 (
plain)
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
|
#!/bin/sh
if [ "$ADD_NOINDEX_HEADER" = "true" ]; then
cat > /etc/nginx/conf.d/noindex.conf << 'EOF'
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html;
etag on;
add_header Cache-Control "no-cache" always;
add_header X-Robots-Tag "noindex, nofollow" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:;" always;
}
}
EOF
# Remove default server config
rm -f /etc/nginx/conf.d/default.conf
else
cat > /etc/nginx/conf.d/default.conf << 'EOF'
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html;
etag on;
add_header Cache-Control "no-cache" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:;" always;
}
}
EOF
fi
exec nginx -g "daemon off;"
|