mirror of
https://gitlab.archlinux.org/archlinux/infrastructure.git
synced 2026-11-06 13:28:48 +01:00
It provides a better UX compared to certbot and is one less moving part. The switch is done where it is possible and sensible. That is basically all the places where nginx is the sole user of the certificate. Certificates using the DNS-01 challenge (e.g. geo mirrors) or which are used with stream (e.g. rsync over TLS) still require certbot as it is currently not supported in the native integration[2][3]. [1] https://blog.nginx.org/blog/native-support-for-acme-protocol [2] https://github.com/nginx/nginx-acme/issues/11 [3] https://github.com/nginx/nginx-acme/issues/13
200 lines
5.5 KiB
Django/Jinja
200 lines
5.5 KiB
Django/Jinja
upstream archweb {
|
|
server unix:///run/uwsgi/archweb.sock;
|
|
}
|
|
|
|
{% for domain in service_alternate_domains | default([]) %}
|
|
server {
|
|
include snippets/listen-80.conf;
|
|
|
|
server_name {{ domain }};
|
|
|
|
access_log {{ maintenance_logs_dir }}/{{ service_domain }}-access.log reduced;
|
|
access_log {{ maintenance_logs_dir }}/{{ service_domain }}-access.log.json json_reduced;
|
|
error_log {{ maintenance_logs_dir }}/{{ service_domain }}-error.log;
|
|
|
|
include snippets/letsencrypt.conf;
|
|
|
|
location / {
|
|
access_log off;
|
|
return 302 https://$server_name$request_uri;
|
|
}
|
|
}
|
|
|
|
server {
|
|
include snippets/listen-443.conf;
|
|
server_name {{ domain }};
|
|
|
|
access_log {{ maintenance_logs_dir }}/{{ service_domain }}-access.log reduced;
|
|
access_log {{ maintenance_logs_dir }}/{{ service_domain }}-access.log.json json_reduced;
|
|
error_log {{ maintenance_logs_dir }}/{{ service_domain }}-error.log;
|
|
|
|
acme_certificate letsencrypt;
|
|
ssl_certificate $acme_certificate;
|
|
ssl_certificate_key $acme_certificate_key;
|
|
|
|
location / {
|
|
access_log off;
|
|
return 302 https://{{ service_domain }};
|
|
}
|
|
}
|
|
|
|
{% endfor %}
|
|
{% for domain in service_legacy_domains | default([]) %}
|
|
server {
|
|
include snippets/listen-80.conf;
|
|
|
|
server_name {{ domain }};
|
|
|
|
access_log {{ maintenance_logs_dir }}/{{ service_domain }}-access.log reduced;
|
|
access_log {{ maintenance_logs_dir }}/{{ service_domain }}-access.log.json json_reduced;
|
|
error_log {{ maintenance_logs_dir }}/{{ service_domain }}-error.log;
|
|
|
|
include snippets/letsencrypt.conf;
|
|
|
|
location / {
|
|
access_log off;
|
|
return 302 https://$server_name$request_uri;
|
|
}
|
|
}
|
|
|
|
server {
|
|
include snippets/listen-443.conf;
|
|
server_name {{ domain }};
|
|
|
|
access_log {{ maintenance_logs_dir }}/{{ service_domain }}-access.log reduced;
|
|
access_log {{ maintenance_logs_dir }}/{{ service_domain }}-access.log.json json_reduced;
|
|
error_log {{ maintenance_logs_dir }}/{{ service_domain }}-error.log;
|
|
|
|
acme_certificate letsencrypt key=rsa:4096;
|
|
ssl_certificate $acme_certificate;
|
|
ssl_certificate_key $acme_certificate_key;
|
|
|
|
location / {
|
|
access_log off;
|
|
return 302 https://{{ service_domain }};
|
|
}
|
|
}
|
|
|
|
{% endfor %}
|
|
server {
|
|
include snippets/listen-80.conf;
|
|
|
|
server_name {{ service_domain }};
|
|
|
|
access_log {{ maintenance_logs_dir }}/{{ service_domain }}-access.log reduced;
|
|
access_log {{ maintenance_logs_dir }}/{{ service_domain }}-access.log.json json_reduced;
|
|
error_log {{ maintenance_logs_dir }}/{{ service_domain }}-error.log;
|
|
|
|
include snippets/letsencrypt.conf;
|
|
|
|
location / {
|
|
access_log off;
|
|
return 302 https://$server_name$request_uri;
|
|
}
|
|
}
|
|
|
|
server {
|
|
include snippets/listen-443.conf;
|
|
server_name {{ service_domain }};
|
|
|
|
access_log {{ maintenance_logs_dir }}/{{ service_domain }}-access.log reduced;
|
|
access_log {{ maintenance_logs_dir }}/{{ service_domain }}-access.log.json json_reduced;
|
|
error_log {{ maintenance_logs_dir }}/{{ service_domain }}-error.log;
|
|
|
|
acme_certificate letsencrypt;
|
|
ssl_certificate $acme_certificate;
|
|
ssl_certificate_key $acme_certificate_key;
|
|
|
|
error_page 503 /503.html;
|
|
|
|
location = /.well-known/matrix/server {
|
|
alias {{ archweb_dir }}/archlinux.org/.well-known/matrix/server;
|
|
default_type application/json;
|
|
}
|
|
|
|
location = /.well-known/matrix/client {
|
|
alias {{ archweb_dir }}/archlinux.org/.well-known/matrix/client;
|
|
default_type application/json;
|
|
include snippets/headers.conf;
|
|
add_header Access-Control-Allow-Origin *;
|
|
}
|
|
|
|
location = /robots.txt {
|
|
alias {{ archweb_dir }}/archlinux.org/robots.txt;
|
|
}
|
|
|
|
location = /humans.txt {
|
|
alias {{ archweb_dir }}/archlinux.org/humans.txt;
|
|
}
|
|
|
|
location = /google7827eadf026b4a87.html {
|
|
alias {{ archweb_dir }}/archlinux.org/google7827eadf026b4a87.html;
|
|
}
|
|
|
|
location = /BingSiteAuth.xml {
|
|
alias {{ archweb_dir }}/archlinux.org/BingSiteAuth.xml;
|
|
}
|
|
|
|
location = /favicon.ico {
|
|
alias {{ archweb_dir }}/collected_static/favicon.ico;
|
|
}
|
|
|
|
location /pacman/ {
|
|
alias {{ archweb_dir }}/archlinux.org/pacman/;
|
|
}
|
|
|
|
location /netcfg/ {
|
|
alias {{ archweb_dir }}/archlinux.org/netcfg/;
|
|
}
|
|
|
|
location /logos/ {
|
|
alias {{ archweb_dir }}/archlinux.org/logos/;
|
|
}
|
|
|
|
location ~ ^/iso/(.*\.(iso|img|tar\.gz|sfs)$) {
|
|
deny all;
|
|
}
|
|
|
|
location /iso/ {
|
|
alias {{ archweb_rsync_iso_dir }};
|
|
}
|
|
|
|
# Cache django's css, js and png files.
|
|
location /static/ {
|
|
expires 30d;
|
|
include snippets/headers.conf;
|
|
add_header Pragma public;
|
|
add_header Cache-Control "public";
|
|
alias {{ archweb_dir }}/collected_static/;
|
|
}
|
|
|
|
location /img/ {
|
|
alias {{ archweb_dir }}/media/img/;
|
|
}
|
|
|
|
location /retro/ {
|
|
alias {{ archweb_retro_dir }};
|
|
}
|
|
|
|
if ($remote_addr = {{ maintenance_remote_machine }}) {
|
|
set $maintenance_remote_machine true;
|
|
}
|
|
|
|
location / {
|
|
include uwsgi_params;
|
|
|
|
if ($maintenance_remote_machine = true) {
|
|
access_log /var/log/nginx/{{ archweb_domain }}/access.log main;
|
|
access_log /var/log/nginx/{{ archweb_domain }}/access.log.json json_main;
|
|
uwsgi_pass archweb;
|
|
break;
|
|
}
|
|
|
|
return 503;
|
|
}
|
|
|
|
location = /503.html {
|
|
root {{ maintenance_http_dir }}/{{ service_domain }};
|
|
}
|
|
}
|