1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
| user www-data; worker_processes auto; pid /run/nginx.pid;
error_log /var/log/nginx/error.log warn;
events { worker_connections1024; }
http {
include /etc/nginx/mime.types; default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status$body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfileon; tcp_nopushon; tcp_nodelayon;
keepalive_timeout65;
gzipon; gzip_disable"msie6"; gzip_varyon; gzip_proxied any; gzip_comp_level6; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
add_header X-Frame-Options "SAMEORIGIN" always; add_header X-XSS-Protection "1; mode=block" always; add_header X-Content-Type-Options "nosniff" always; add_header Referrer-Policy "no-referrer-when-downgrade" always; add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always;
ssl_protocols TLSv1.2 TLSv1.3; ssl_prefer_server_cipherson; ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_session_cache shared:SSL:10m; ssl_session_timeout1d; ssl_session_ticketsoff;
ssl_dhparam /etc/nginx/dhparam.pem;
ssl_staplingon; ssl_stapling_verifyon; resolver8.8.8.88.8.4.4 valid=300s; resolver_timeout5s;
upstream backend { server127.0.0.1:8080 max_fails=3 fail_timeout=30s; server127.0.0.1:8081 max_fails=3 fail_timeout=30s; server127.0.0.1:8082 max_fails=3 fail_timeout=30s; }
server { listen80; server_name example.com www.example.com;
return301 https://$server_name$request_uri; }
server { listen443 ssl http2; listen443 quic reuseport; add_header Alt-Svc 'h3-23=":443"; ma=86400';
server_name example.com www.example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
root /var/www/example.com; index index.html index.htm index.php;
error_page404 /404.html; error_page500502503504 /50x.html;
location / { proxy_pass http://backend; proxy_http_version1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass$http_upgrade; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; }
location~* \.(jpg|jpeg|png|gif|ico|css|js)$ { expires30d; add_header Cache-Control "public, no-transform"; }
location~ /\. { deny all; access_logoff; log_not_foundoff; }
}
limit_req_zone$binary_remote_addr zone=one:10m rate=10r/s; server { location / { limit_req zone=one burst=5 nodelay; } }
fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=FASTCGI_CACHE:100m inactive=60m; fastcgi_cache_key"$scheme$request_method$host$request_uri";
server { location~ \.php$ { fastcgi_cache FASTCGI_CACHE; fastcgi_cache_valid20030210m; fastcgi_cache_valid4041m; add_header X-Fastcgi-Cache $upstream_cache_status; } }
client_max_body_size10M;
add_header'Access-Control-Allow-Origin''*'; }
|