gitea: prevent bots from downloading archives

This commit is contained in:
Markus 2022-04-02 11:03:09 +02:00
parent 0893017a01
commit 3c901c5e2e
3 changed files with 11 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1,4 @@
User-agent: *
Disallow: /*/*/archive/*.bundle$
Disallow: /*/*/archive/*.tar.gz$
Disallow: /*/*/archive/*.zip$

View File

@ -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;