diff --git a/roles/archwiki/files/robots.txt b/roles/archwiki/files/robots.txt new file mode 100644 index 0000000000000000000000000000000000000000..97717bea46ba03aa86c59540f4c73b4655450d03 --- /dev/null +++ b/roles/archwiki/files/robots.txt @@ -0,0 +1,9 @@ +User-agent: * +Disallow: /index.php?diff= +Disallow: /index.php?oldid= +Disallow: /index.php?title=Help +Disallow: /index.php?title=Image +Disallow: /index.php?title=MediaWiki +Disallow: /index.php?title=Special: +Disallow: /index.php?title=Template +Disallow: /skins/ diff --git a/roles/archwiki/tasks/main.yml b/roles/archwiki/tasks/main.yml index 676c6b5b216d6b116280e9c1318280c131570ad5..fb73532103ea8da771479c01f28313bbd72eeb41 100644 --- a/roles/archwiki/tasks/main.yml +++ b/roles/archwiki/tasks/main.yml @@ -20,6 +20,9 @@ - reload nginx tags: ['nginx'] +- name: configure robots.txt + copy: src=robots.txt dest="{{ archwiki_dir }}/robots.txt" owner=root group=root mode=0644 + - name: make nginx log dir file: path=/var/log/nginx/{{ archwiki_domain }} state=directory owner=root group=root mode=0755 diff --git a/roles/archwiki/templates/nginx.d.conf.j2 b/roles/archwiki/templates/nginx.d.conf.j2 index b49a9dcdf209af55aa5bbfe1a01a0b07ec7c1998..d8f7ac0cca444cf20f99076d05779831085e9b23 100644 --- a/roles/archwiki/templates/nginx.d.conf.j2 +++ b/roles/archwiki/templates/nginx.d.conf.j2 @@ -38,6 +38,10 @@ server { return 403; } + location /robots.txt { + alias {{ archwiki_dir }}/robots.txt; + } + location ^~ /. { log_not_found off; deny all;