mirror of
https://github.com/DanWin/mail-hosting.git
synced 2024-11-21 15:10:25 +00:00
210 lines
4.8 KiB
Nginx Configuration File
210 lines
4.8 KiB
Nginx Configuration File
user www-data;
|
|
worker_processes 1;
|
|
pid /run/nginx.pid;
|
|
pcre_jit on;
|
|
worker_rlimit_nofile 30000;
|
|
worker_shutdown_timeout 1m;
|
|
include /etc/nginx/modules-enabled/*.conf;
|
|
|
|
events {
|
|
worker_connections 20000;
|
|
multi_accept on;
|
|
}
|
|
|
|
http {
|
|
##
|
|
# Basic Settings
|
|
##
|
|
|
|
sendfile on;
|
|
aio threads;
|
|
aio_write on;
|
|
directio 512;
|
|
tcp_nopush on;
|
|
tcp_nodelay on;
|
|
keepalive_timeout 65;
|
|
types_hash_max_size 2048;
|
|
server_tokens off;
|
|
client_max_body_size 10G;
|
|
client_body_timeout 10s;
|
|
client_header_timeout 10s;
|
|
|
|
server_names_hash_bucket_size 128;
|
|
server_names_hash_max_size 1024;
|
|
server_name_in_redirect off;
|
|
port_in_redirect off;
|
|
charset UTF-8;
|
|
index index.html index.htm index.php;
|
|
|
|
include /etc/nginx/mime.types;
|
|
default_type application/octet-stream;
|
|
|
|
##
|
|
# SSL Settings
|
|
##
|
|
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_prefer_server_ciphers on;
|
|
ssl_ecdh_curve X448:X25519:secp521r1:secp384r1;
|
|
ssl_ciphers HIGH:!PSK:!RSA:!aNULL:!MD5:!SHA:!CAMELLIA:!AES+SHA256:!AES+SHA384;
|
|
ssl_session_cache shared:SSL:10m;
|
|
ssl_early_data off;
|
|
ssl_stapling on;
|
|
ssl_stapling_verify on;
|
|
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
|
|
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
|
|
ssl_dhparam /etc/nginx/dh4096.pem;
|
|
|
|
##
|
|
# Logging Settings
|
|
##
|
|
log_format custom '0.0.0.0 - $remote_user [$time_local] "$request" $status $bytes_sent "$http_referer" "$http_user_agent"';
|
|
access_log /var/log/nginx/access.log custom buffer=32k flush=1m;
|
|
error_log /var/log/nginx/error.log notice;
|
|
log_not_found off;
|
|
|
|
resolver 127.0.0.1 [::1];
|
|
resolver_timeout 2s;
|
|
root /var/www/html;
|
|
map $http_upgrade $connection_upgrade {
|
|
default upgrade;
|
|
'' '';
|
|
}
|
|
proxy_http_version 1.1;
|
|
proxy_buffer_size 8k;
|
|
proxy_buffering on;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header Proxy "";
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header X-Forwarded-Port "";
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
proxy_ignore_client_abort on;
|
|
|
|
##
|
|
# Gzip Settings
|
|
##
|
|
|
|
gzip on;
|
|
|
|
gzip_vary off;
|
|
gzip_proxied off;
|
|
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 image/svg+xml;
|
|
|
|
brotli on;
|
|
brotli_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;
|
|
|
|
##
|
|
# Virtual Host Configs
|
|
##
|
|
|
|
include /etc/nginx/sites-enabled/*;
|
|
}
|
|
|
|
stream {
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_prefer_server_ciphers on;
|
|
ssl_ecdh_curve X448:X25519:secp521r1:secp384r1:secp256k1;
|
|
ssl_ciphers HIGH:!PSK:!RSA:!aNULL:!MD5:!SHA:!CAMELLIA:!AES+SHA256:!AES+SHA384;
|
|
ssl_session_cache shared:SSLSTREAM:10m;
|
|
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
|
|
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
|
|
ssl_dhparam /etc/nginx/dh4096.pem;
|
|
#smtp
|
|
server {
|
|
listen [::]:25 fastopen=100 ipv6only=off;
|
|
proxy_pass smtp_backend_servers;
|
|
}
|
|
server {
|
|
listen [::]:587 fastopen=100 ipv6only=off;
|
|
proxy_pass smtp_auth_backend_servers;
|
|
}
|
|
server {
|
|
listen [::]:465 fastopen=100 ipv6only=off;
|
|
proxy_pass smtps_backend_servers;
|
|
}
|
|
#mysql
|
|
server {
|
|
listen 127.0.0.1:3306 fastopen=100;
|
|
proxy_pass mysql_backend_servers;
|
|
}
|
|
#imap
|
|
server {
|
|
listen [::]:143 fastopen=100 ipv6only=off;
|
|
proxy_pass imap_backend_servers;
|
|
}
|
|
server {
|
|
listen [::]:993 fastopen=100 ipv6only=off;
|
|
proxy_pass imaps_backend_servers;
|
|
}
|
|
#pop3
|
|
server {
|
|
listen [::]:110 fastopen=100 ipv6only=off;
|
|
proxy_pass pop3_backend_servers;
|
|
}
|
|
server {
|
|
listen [::]:995 fastopen=100 ipv6only=off;
|
|
proxy_pass pop3s_backend_servers;
|
|
}
|
|
#xmpp
|
|
server {
|
|
listen [::]:5269 fastopen=100 ipv6only=off;
|
|
proxy_pass 10.9.0.2:5269;
|
|
}
|
|
server {
|
|
listen [::]:5000 fastopen=100 ipv6only=off;
|
|
proxy_pass 10.9.0.2:5000;
|
|
}
|
|
server {
|
|
listen [::]:5222 fastopen=100 ipv6only=off;
|
|
proxy_pass 10.9.0.2:5222;
|
|
}
|
|
server {
|
|
listen [::]:5223 fastopen=100 ipv6only=off;
|
|
proxy_pass 10.9.0.2:5223;
|
|
}
|
|
server {
|
|
listen [::]:5280 fastopen=100 ipv6only=off;
|
|
proxy_pass 10.9.0.2:5280;
|
|
}
|
|
server {
|
|
listen [::]:5281 fastopen=100 ipv6only=off;
|
|
proxy_pass 10.9.0.2:5281;
|
|
}
|
|
#https
|
|
server {
|
|
listen [::]:443 fastopen=100 ipv6only=off;
|
|
proxy_pass https_backend_servers;
|
|
}
|
|
#upstream servers
|
|
upstream https_backend_servers {
|
|
server 10.9.0.2:443;
|
|
}
|
|
upstream imaps_backend_servers {
|
|
server 10.9.0.2:993;
|
|
}
|
|
upstream imap_backend_servers {
|
|
server 10.9.0.2:143;
|
|
}
|
|
upstream pop3s_backend_servers {
|
|
server 10.9.0.2:995;
|
|
}
|
|
upstream pop3_backend_servers {
|
|
server 10.9.0.2:110;
|
|
}
|
|
upstream smtp_backend_servers {
|
|
server 10.9.0.2:25;
|
|
}
|
|
upstream smtp_auth_backend_servers {
|
|
server 10.9.0.2:587;
|
|
}
|
|
upstream smtps_backend_servers {
|
|
server 10.9.0.2:465;
|
|
}
|
|
upstream mysql_backend_servers {
|
|
server 10.9.0.2:3306;
|
|
}
|
|
}
|