FreeBSD/jails/config/pkgp/nginx.conf

229 lines
6.5 KiB
Nginx Configuration File
Raw Normal View History

2020-02-25 11:28:31 -08:00
user www wheel;
worker_processes 8;
events {
2022-04-19 13:38:56 -07:00
worker_connections 1024;
2020-02-25 11:28:31 -08:00
}
http {
include mime.types;
default_type application/octet-stream;
2022-04-19 13:38:56 -07:00
access_log /var/log/nginx/access.log;
2020-02-25 11:28:31 -08:00
access_log off;
2022-04-19 13:38:56 -07:00
error_log /var/log/nginx/error.log;
2020-02-25 11:28:31 -08:00
2022-04-19 13:38:56 -07:00
aio on;
2020-02-25 11:28:31 -08:00
sendfile on;
tcp_nopush on;
2021-04-01 01:23:14 -07:00
resolver 192.168.0.5 [fd01::5];
2020-02-25 11:28:31 -08:00
server {
listen *:80;
listen [::]:80;
server_name pkgp.ahlawat.com;
root /usr/local/share/poudriere/html;
location /data {
alias /mnt/poudriere/data/logs/bulk;
autoindex on;
}
location /packages {
root /mnt/poudriere/data;
autoindex on;
}
#error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}
}
server {
2022-04-19 13:38:56 -07:00
listen *:443 ssl http2;
listen [::]:443 ssl http2;
2020-02-25 11:28:31 -08:00
server_name pkgp.ahlawat.com;
root /usr/local/share/poudriere/html;
ssl_certificate /mnt/certs/fullchain.pem;
ssl_certificate_key /mnt/certs/privkey.pem;
2022-04-19 13:38:56 -07:00
ssl_session_timeout 1d;
ssl_session_cache shared:MozSSL:10m; # about 40000 sessions
ssl_session_tickets off;
# modern configuration
ssl_protocols TLSv1.3;
ssl_prefer_server_ciphers off;
# HSTS (ngx_http_headers_module is required) (63072000 seconds)
add_header Strict-Transport-Security "max-age=63072000" always;
2020-02-25 11:28:31 -08:00
2022-04-19 13:38:56 -07:00
# OCSP stapling
ssl_stapling on;
ssl_stapling_verify on;
# verify chain of trust of OCSP response using Root CA and Intermediate certs
ssl_trusted_certificate /mnt/certs/fullchain.pem;
2020-02-25 11:28:31 -08:00
location /data {
alias /mnt/poudriere/data/logs/bulk;
autoindex on;
}
location /packages {
root /mnt/poudriere/data;
autoindex on;
}
#error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}
}
2022-04-19 13:38:56 -07:00
# https://www.nginx.com/blog/nginx-caching-guide/
# https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_valid
proxy_cache_path /mnt/cache/pkg/ levels=1:2 keys_zone=pkg_cache:10m max_size=10g inactive=1d use_temp_path=off;
2020-02-25 11:28:31 -08:00
server {
listen *:80;
listen [::]:80;
server_name pkgp-freebsd-pkg.ahlawat.com;
2022-04-19 13:38:56 -07:00
# root /mnt/cache/pkg/;
# autoindex on;
proxy_http_version 1.1;
proxy_socket_keepalive on;
proxy_set_header Host $host;
# add_header X-Proxy-Cache $upstream_cache_status;
2020-02-25 11:28:31 -08:00
location / {
proxy_cache pkg_cache;
2022-04-19 13:38:56 -07:00
proxy_cache_valid 1d;
2020-02-25 11:28:31 -08:00
proxy_cache_revalidate on;
proxy_cache_lock on;
2022-04-19 13:38:56 -07:00
proxy_ignore_headers X-Accel-Expires Expires Cache-Control Set-Cookie;
proxy_hide_header X-Accel-Expires;
proxy_hide_header Expires;
proxy_hide_header Cache-Control;
proxy_hide_header Set-Cookie;
2020-02-25 11:28:31 -08:00
proxy_pass http://pkg-mirrors;
2022-04-19 13:38:56 -07:00
proxy_next_upstream error timeout invalid_header http_404;
2020-02-25 11:28:31 -08:00
}
}
upstream pkg-mirrors {
server localhost:8001;
server localhost:8002 backup;
server localhost:8003 backup;
}
server {
listen *:8001;
listen [::]:8001;
server_name localhost;
location / {
2022-04-19 13:38:56 -07:00
proxy_pass http://pkg0.tuk.FreeBSD.org;
2020-02-25 11:28:31 -08:00
}
}
server {
listen *:8002;
listen [::]:8002;
server_name localhost;
location / {
2022-04-19 13:38:56 -07:00
proxy_pass http://pkg0.bbt.FreeBSD.org;
2020-02-25 11:28:31 -08:00
}
}
server {
listen *:8003;
listen [::]:8003;
server_name localhost;
location / {
proxy_pass http://pkg0.nyi.FreeBSD.org;
}
}
2022-04-19 13:38:56 -07:00
proxy_cache_path /mnt/cache/update/ levels=1:2 keys_zone=update_cache:10m max_size=10g inactive=1d use_temp_path=off;
2020-02-25 11:28:31 -08:00
server {
listen *:80;
listen [::]:80;
server_name pkgp-freebsd-update.ahlawat.com;
2022-04-19 13:38:56 -07:00
# root /mnt/cache/update/;
# autoindex on;
proxy_http_version 1.1;
proxy_socket_keepalive on;
proxy_set_header Host $host;
# add_header X-Proxy-Cache $upstream_cache_status;
2020-02-25 11:28:31 -08:00
location / {
proxy_cache update_cache;
2022-04-19 13:38:56 -07:00
proxy_cache_valid 1d;
2020-02-25 11:28:31 -08:00
proxy_cache_revalidate on;
proxy_cache_lock on;
2022-04-19 13:38:56 -07:00
proxy_ignore_headers X-Accel-Expires Expires Cache-Control Set-Cookie;
proxy_hide_header X-Accel-Expires;
proxy_hide_header Expires;
proxy_hide_header Cache-Control;
proxy_hide_header Set-Cookie;
2020-02-25 11:28:31 -08:00
proxy_pass http://update-mirrors;
2022-04-19 13:38:56 -07:00
proxy_next_upstream error timeout invalid_header http_404;
2020-02-25 11:28:31 -08:00
}
}
upstream update-mirrors {
server localhost:8011;
server localhost:8012;
server localhost:8013;
server localhost:8014;
}
server {
listen *:8011;
listen [::]:8011;
server_name localhost;
location / {
proxy_pass http://update1.FreeBSD.org;
}
}
server {
listen *:8012;
listen [::]:8012;
server_name localhost;
location / {
proxy_pass http://update2.FreeBSD.org;
}
}
server {
listen *:8013;
listen [::]:8013;
server_name localhost;
location / {
2021-04-01 01:23:14 -07:00
proxy_pass http://update5.FreeBSD.org;
2020-02-25 11:28:31 -08:00
}
}
server {
listen *:8014;
listen [::]:8014;
server_name localhost;
location / {
proxy_pass http://update4.FreeBSD.org;
}
}
2022-04-19 13:38:56 -07:00
2020-02-25 11:28:31 -08:00
}