Skip to content

Commit

Permalink
revert adding http3 support, add set-misc for nonce
Browse files Browse the repository at this point in the history
  • Loading branch information
paskal committed Jan 5, 2024
1 parent 91b0118 commit 834e5f1
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 33 deletions.
8 changes: 4 additions & 4 deletions config/nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
FROM macbre/nginx-http3
FROM alpine:edge

LABEL org.opencontainers.image.authors="Dmitry Verkhoturov <[email protected]>" \
org.opencontainers.image.description="nginx with brotli installed and running as non-root user, with reload for cert renewal once in six hours" \
org.opencontainers.image.documentation="https://github.com/paskal/bitrix.infra" \
org.opencontainers.image.source="https://github.com/paskal/bitrix.infra.git" \
org.opencontainers.image.title="nginx"

USER root

# for shadow package
RUN echo http://dl-2.alpinelinux.org/alpine/edge/community/ >> /etc/apk/repositories

# shadow for usermod
RUN apk add --no-cache shadow
# brotli for compression
# set-misc for nonce random string generation
RUN apk add --no-cache nginx-mod-http-brotli nginx-mod-http-set-misc shadow

RUN usermod -u 1000 nginx
RUN groupmod -g 1000 nginx
Expand Down
10 changes: 4 additions & 6 deletions config/nginx/conf.d/adminer.conf
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
server {
listen 443 ssl;
listen 443 quic reuseport;
add_header alt-svc 'h3=":443"; ma=86400';
ssl_certificate /etc/nginx/letsencrypt/live/favor-group.ru/fullchain.pem;
ssl_certificate_key /etc/nginx/letsencrypt/live/favor-group.ru/privkey.pem;
ssl_trusted_certificate /etc/nginx/letsencrypt/live/favor-group.ru/chain.pem;
listen 443 http2 ssl;
ssl_certificate /etc/nginx/letsencrypt/live/favor-group.ru/fullchain.pem;
ssl_certificate_key /etc/nginx/letsencrypt/live/favor-group.ru/privkey.pem;
ssl_trusted_certificate /etc/nginx/letsencrypt/live/favor-group.ru/chain.pem;

server_name adminer.favor-group.ru;
# Dmitry Verkhoturov and Eugene Donich external address
Expand Down
6 changes: 2 additions & 4 deletions config/nginx/conf.d/cdn.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ map $http_origin $allow_origin {
}

server {
listen 443 ssl;
listen 443 quic;
listen 443 http2 ssl;

server_name static.cdn-favor-group.ru;

Expand All @@ -17,8 +16,7 @@ server {
}

server {
listen 443 ssl;
listen 443 quic;
listen 443 http2 ssl;

server_name dev.cdn-favor-group.ru;

Expand Down
3 changes: 1 addition & 2 deletions config/nginx/conf.d/dev-test.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
server {
listen 443 ssl;
listen 443 quic;
listen 443 http2 ssl;

server_name dev-test.favor-group.ru;

Expand Down
2 changes: 1 addition & 1 deletion config/nginx/conf.d/dev.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
server {
listen 443 ssl;
listen 443 http2 ssl;

server_name dev.favor-group.ru;

Expand Down
4 changes: 1 addition & 3 deletions config/nginx/conf.d/hooks.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
server {
listen 443 ssl;
listen 443 quic;

listen 443 http2 ssl;
server_name hooks.favor-group.ru;
location / {
proxy_read_timeout 600;
Expand Down
6 changes: 3 additions & 3 deletions config/nginx/conf.d/prod.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
server {
listen 443 reuseport ssl;
listen 443 http2 reuseport ssl;

server_name favor-group.ru;

Expand All @@ -19,7 +19,7 @@ server {
}

server {
listen 443 ssl;
listen 443 http2 ssl;

server_name spb.favor-group.ru;

Expand All @@ -39,7 +39,7 @@ server {
}

server {
listen 443 ssl;
listen 443 http2 ssl;

server_name tula.favor-group.ru;

Expand Down
4 changes: 2 additions & 2 deletions config/nginx/conf.d/redirects.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# https www is a special case
server {
listen 443 ssl;
listen 443 ssl http2;
server_name www.favor-group.ru;
ssl_certificate /etc/nginx/letsencrypt/live/favor-group.ru/fullchain.pem;
ssl_certificate_key /etc/nginx/letsencrypt/live/favor-group.ru/privkey.pem;
Expand All @@ -25,7 +25,7 @@ server {
}

server {
listen 443 default_server ssl;
listen 443 default_server ssl http2;
ssl_certificate /etc/nginx/letsencrypt/live/favor-group.ru/fullchain.pem;
ssl_certificate_key /etc/nginx/letsencrypt/live/favor-group.ru/privkey.pem;
ssl_trusted_certificate /etc/nginx/letsencrypt/live/favor-group.ru/chain.pem;
Expand Down
6 changes: 2 additions & 4 deletions config/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ worker_processes auto;
error_log /var/log/nginx/other.error.log warn;
pid /var/run/nginx.pid;

#load_module modules/ngx_http_brotli_filter_module.so;
#load_module modules/ngx_http_brotli_static_module.so;
load_module modules/ngx_http_brotli_filter_module.so;
load_module modules/ngx_http_brotli_static_module.so;

events {
worker_connections 8192;
Expand Down Expand Up @@ -112,8 +112,6 @@ http {

# HSTS (ngx_http_headers_module is required) (63072000 seconds)
add_header Strict-Transport-Security 'max-age=31536000; includeSubdomains; preload' always;
# http3
#add_header alt-svc 'h3=":443"; ma=86400';

# Reverse CloudFlare proxy
# DO NOT use CloudFlare in Russia, Yandex will ban you!
Expand Down
3 changes: 0 additions & 3 deletions config/nginx/security_headers.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@ add_header Strict-Transport-Security 'max-age=31536000; includeSubdomains; prelo

# for the sake of better benchmark score
add_header Referrer-Policy same-origin;

# http3
#add_header alt-svc 'h3=":443"; ma=86400';
1 change: 0 additions & 1 deletion config/nginx/static-cdn.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ location ~* ^.+\.(xml|txt|jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|map|js|json|
expires max;
add_header Cache-Control public;
add_header Access-Control-Allow-Origin $allow_origin;
add_header alt-svc 'h3=":443"; ma=86400';
include security_headers.conf;
valid_referers none blocked favor-group.ru *.favor-group.ru *.cdn-favor-group.ru;
if ($invalid_referer) {
Expand Down

0 comments on commit 834e5f1

Please sign in to comment.