diff --git a/Dockerfile b/Dockerfile index fd8fc98..6b2f239 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,3 +4,4 @@ COPY privkey.pem /etc/nginx/ COPY fullchain.pem /etc/nginx/ COPY default.conf /etc/nginx/conf.d/ COPY index.html /usr/share/nginx/html/404/ +COPY robots.txt /usr/share/nginx/html/robots.txt diff --git a/default.conf b/default.conf index 42be5a7..17b399d 100644 --- a/default.conf +++ b/default.conf @@ -280,6 +280,13 @@ server { } } + location /robots.txt { + if ($host = services,pena.digital) { + return 301 https://pena.digital/robots.txt; + } + try_files $uri $uri/ /index.html; + } + listen [::]:443 ssl ipv6only=on; listen 443 ssl; # managed by Certbot ssl_certificate /etc/nginx/fullchain.pem; # managed by Certbot @@ -290,5 +297,13 @@ server { listen 80 ; listen [::]:80 ; server_name _; + + location /robots.txt { + if ($host = services,pena.digital) { + return 301 https://pena.digital/robots.txt; + } + try_files $uri $uri/ /index.html; + } + return 301 https://$host$request_uri; } diff --git a/robots.txt b/robots.txt new file mode 100644 index 0000000..1f53798 --- /dev/null +++ b/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: /