infra/roles/jenkins/templates/01-jenkins.conf.j2

72 lines
2.5 KiB
Django/Jinja

# distributed with ansible
server {
listen 443 ssl;
{% if inventory_hostname in wg_clients -%}
listen {{ wg_clients[inventory_hostname].ip }}:443 ssl http2;
{% endif -%}
# listen [::]:443 ssl;
include /etc/nginx/authelia_internal.conf;
include listen-proxy-protocol.conf;
server_name {{ jenkins_url }};
location / {
include /etc/nginx/require_auth.conf;
proxy_pass http://127.0.0.1:{{ jenkins_port }};
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Proto $scheme;
}
# POST /gitea-webhook/post HTTP/2.0
# User-Agent: Go-http-client/1.1
# does not require authelia auth
location /gitea-webhook {
proxy_pass http://127.0.0.1:{{ jenkins_port }};
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Proto $scheme;
}
# dont require auth for build icons
location /buildStatus/icon {
proxy_pass http://127.0.0.1:{{ jenkins_port }};
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Proto $scheme;
}
access_log /var/log/nginx/access_{{ jenkins_url }}.log main;
error_log /var/log/nginx/error_{{ jenkins_url }}.log warn;
ssl_certificate /usr/local/etc/certs/{{ jenkins_url }}/fullchain.pem;
ssl_certificate_key /usr/local/etc/certs/{{ jenkins_url }}//privkey.pem;
add_header Referrer-Policy "no-referrer" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Download-Options "noopen" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header X-Robots-Tag "none" always;
add_header X-XSS-Protection "1; mode=block" always;
# add_header Content-Security-Policy "img-src 'self' github.com hub.docker.com;" always;
fastcgi_hide_header X-Powered-By;
}