nginx conf #14 HTTP/2 + #15 return

This commit is contained in:
Bastien Lacoste 2022-04-07 12:29:27 +02:00 committed by admin666
parent bf7ed35d08
commit 2a7d5db624
4 changed files with 176 additions and 0 deletions

View File

@ -0,0 +1 @@
client_max_body_size 20M;

View File

@ -0,0 +1,5 @@
# we're in the http context here
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

83
conf/nginx/nginx.conf Normal file
View File

@ -0,0 +1,83 @@
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}

View File

@ -0,0 +1,87 @@
server {
listen 80;
listen [::]:80;
server_name pad.chalec.org;
root /var/www/html;
return 301 https://$hostname$request_uri;
}
server {
charset UTF-8;
server_name pad.chalec.org;
listen [::]:443 ssl http2 default_server;
listen 443 http2 proxy_protocol ssl default_server;
include snippets/letsencrypt.conf;
set_real_ip_from 192.168.1.1;
real_ip_header proxy_protocol;
ssi on;
ssi_last_modified on;
#proxy_set_header X-Real-IP $proxy_protocol_addr;
#proxy_set_header X-Forwarded-For $proxy_protocol_addr;
root /var/www/html;
add_header Strict-Transport-Security "max-age=31536000" always;
add_header Content-Security-Policy "default-src 'self' 'unsafe-eval' 'unsafe-inline'; object-src 'none'; connect-src 'self' wss://pad.chalec.org; frame-ancestors 'self'";
add_header X-XSS-Protection "1; mode=block";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-options nosniff;
access_log /var/log/nginx/pad.chalec.org/access.log;
error_log /var/log/nginx/pad.chalec.org/error.log warn;
error_page 404 /404.html;
error_page 502 /502.html;
location /502.html {
root /var/www/html;
internal;
}
location /404.html {
root /var/www/html;
internal;
}
location /.well-known/statoolinfos {
alias /var/www/html/.well-known/statoolinfos/;
autoindex on;
}
location / {
#proxy_protocol on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
# proxy_http_version 1.1;
proxy_pass http://127.0.0.1:9001;
proxy_buffering off;
# WebSocket proxying - from https://nginx.org/en/docs/http/websocket.html
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
location /about.html {
alias /var/www/html/pad/about.html;
}
location /logo.svg {
alias /var/www/html/pad/pad.chalec.org.svg;
}
}