From 5106e34fb6fae336861927725a0e0476e739e344 Mon Sep 17 00:00:00 2001 From: Tommy Date: Sun, 13 Oct 2024 14:46:21 -0700 Subject: [PATCH] Add add.txt & disable unnecessary logging --- etc/nginx/snippets/robots.conf | 1 + etc/nginx/snippets/universal_paths.conf | 13 +++++++++++++ setup.sh | 2 ++ srv/nginx/ads.txt | 1 + srv/nginx/app-ads.txt | 1 + 5 files changed, 18 insertions(+) create mode 100644 srv/nginx/ads.txt create mode 100644 srv/nginx/app-ads.txt diff --git a/etc/nginx/snippets/robots.conf b/etc/nginx/snippets/robots.conf index 1629276..b0b9d8d 100644 --- a/etc/nginx/snippets/robots.conf +++ b/etc/nginx/snippets/robots.conf @@ -4,5 +4,6 @@ add_header X-Robots-Tag "noindex, nofollow" always; location = /robots.txt { root /srv/nginx; allow all; + log_not_found off; access_log off; } \ No newline at end of file diff --git a/etc/nginx/snippets/universal_paths.conf b/etc/nginx/snippets/universal_paths.conf index 86c2d3e..6e6afaf 100644 --- a/etc/nginx/snippets/universal_paths.conf +++ b/etc/nginx/snippets/universal_paths.conf @@ -1,3 +1,16 @@ location /.well-known/acme-challenge/ { root /srv/nginx; +} + +location = /ads.txt { + root /srv/nginx; + allow all; + log_not_found off; + access_log off; +} +location = /app-ads.txt { + root /srv/nginx; + allow all; + log_not_found off; + access_log off; } \ No newline at end of file diff --git a/setup.sh b/setup.sh index 918f379..f8b74d4 100644 --- a/setup.sh +++ b/setup.sh @@ -66,6 +66,8 @@ fi # Setup webroot for NGINX ## Explicitly using /var/srv here because SELinux does not follow symlinks sudo semanage fcontext -a -t httpd_sys_content_t "$(realpath /srv/nginx)(/.*)?" +unpriv curl -s https://raw.githubusercontent.com/GrapheneOS/infrastructure/main/srv/nginx/ads.txt | sudo tee /srv/nginx/ads.txt > /dev/null +unpriv curl -s https://raw.githubusercontent.com/GrapheneOS/infrastructure/main/srv/nginx/app-ads.txt | sudo tee /srv/nginx/app-ads.txt > /dev/null unpriv curl -s https://raw.githubusercontent.com/GrapheneOS/infrastructure/main/srv/nginx/robots.txt | sudo tee /srv/nginx/robots.txt > /dev/null sudo mkdir -p /srv/nginx/.well-known/acme-challenge sudo chmod -R 755 /srv/nginx/.well-known/acme-challenge diff --git a/srv/nginx/ads.txt b/srv/nginx/ads.txt new file mode 100644 index 0000000..d6f66b6 --- /dev/null +++ b/srv/nginx/ads.txt @@ -0,0 +1 @@ +placeholder.example.com, placeholder, DIRECT, placeholder \ No newline at end of file diff --git a/srv/nginx/app-ads.txt b/srv/nginx/app-ads.txt new file mode 100644 index 0000000..d6f66b6 --- /dev/null +++ b/srv/nginx/app-ads.txt @@ -0,0 +1 @@ +placeholder.example.com, placeholder, DIRECT, placeholder \ No newline at end of file