diff --git a/roles/gitea/tasks/main.yml b/roles/gitea/tasks/main.yml index d745691..8419117 100644 --- a/roles/gitea/tasks/main.yml +++ b/roles/gitea/tasks/main.yml @@ -50,6 +50,9 @@ template: src=certs.j2 dest=/etc/acertmgr/{{ gitea_domain }}.conf notify: Run acertmgr +- name: Configure robots.txt for gitea + template: src=robots.txt.j2 dest=/opt/gitea/custom/robots.txt owner={{ gitea_user }} + - name: Configure vhost template: src=vhost.j2 dest=/etc/nginx/sites-available/gitea notify: Restart nginx diff --git a/roles/gitea/templates/robots.txt.j2 b/roles/gitea/templates/robots.txt.j2 new file mode 100644 index 0000000..37d3805 --- /dev/null +++ b/roles/gitea/templates/robots.txt.j2 @@ -0,0 +1,4 @@ +User-agent: * +Disallow: /*/*/archive/*.bundle$ +Disallow: /*/*/archive/*.tar.gz$ +Disallow: /*/*/archive/*.zip$ diff --git a/roles/gitea/templates/vhost.j2 b/roles/gitea/templates/vhost.j2 index b3bfeab..3de6d76 100644 --- a/roles/gitea/templates/vhost.j2 +++ b/roles/gitea/templates/vhost.j2 @@ -23,6 +23,10 @@ server { ssl_certificate_key /etc/nginx/ssl/{{ gitea_domain }}.key; ssl_certificate /etc/nginx/ssl/{{ gitea_domain }}.crt; + location /robots.txt { + alias /opt/gitea/custom/robots.txt; + } + location / { client_max_body_size 1024M; proxy_set_header X-Real-IP $remote_addr;