user www-data; worker_processes auto; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf; events { worker_connections 768; # multi_accept on; } http { include /etc/nginx/mime.types; default_type application/octet-stream; server_tokens off; # Define custom log format to include reponse times log_format main_timed '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for" ' '$request_time $upstream_response_time $pipe $upstream_cache_status'; access_log /dev/stdout main_timed; error_log /dev/stderr notice; keepalive_timeout 65; # Default server definition server { listen 80; server_name www.zhongyidj.cn; rewrite ^(.*)$ https://${server_name}$1 permanent; } server { #listen 80 default_server; listen 443 ssl http2; server_name www.zhongyidj.cn; ssl_certificate /etc/nginx/certs/discuz.crt; #ssl证书的证书链 ssl_certificate_key /etc/nginx/certs/discuz.key; #ssl证书的key ssl_session_cache shared:SSL:10m; ssl_session_timeout 24h; ssl_prefer_server_ciphers on; ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH; ssl_protocols TLSv1.2 TLSv1.3; ssl_ecdh_curve secp521r1:secp384r1; ssl_session_tickets off; ssl_stapling on; ssl_stapling_verify on; ssl_buffer_size 4k; add_header X-Content-Type-Options nosniff; add_header X-Frame-Options "SAMEORIGIN"; add_header X-XSS-Protection "1; mode=block"; add_header X-Robots-Tag none; add_header X-Download-Options noopen; add_header X-Permitted-Cross-Domain-Policies none; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always; sendfile on; client_max_body_size 50M; gzip on; gzip_min_length 1024; gzip_types text/css application/x-javascript application/vnd.api+json application/javascript; gzip_disable "MSIE [1-6]\."; gzip_comp_level 2; root /var/www/discuz/public; index index.php index.html; location / { try_files $uri /$uri.html /index.php?$query_string; } # Pass the PHP scripts to PHP-FPM listening on 127.0.0.1:9000 location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_index index.php; include fastcgi_params; } # Deny access to . files, for security location ~ /\. { log_not_found off; deny all; } } # Include other server configs include /etc/nginx/conf.d/*.conf; }