#=========================================================================# # Default Web Domain Template # # DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS # # https://hestiacp.com/docs/server-administration/web-templates.html # #=========================================================================# server { listen %ip%:%proxy_ssl_port% ssl; listen [::]:%proxy_ssl_port% ssl; server_name %domain_idn% %alias_idn%; error_log /var/log/%web_system%/domains/%domain%.error.log error; ssl_certificate %ssl_pem%; ssl_certificate_key %ssl_key%; ssl_stapling on; ssl_stapling_verify on; ssl_session_timeout 1d; #ssl_session_cache shared:SSL:10m; # 如果与其他配置冲突,请注释此项 ssl_protocols TLSv1.2 TLSv1.3; # TLS 1.3 0-RTT anti-replay if ($anti_replay = 307) { return 307 https://$host$request_uri; } if ($anti_replay = 425) { return 425; } include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*; location ~ /\.(?!well-known\/|file) { deny all; return 404; } underscores_in_headers on; # grpc 相关 location ^~ /proto.NezhaService/ { grpc_set_header Host $host; grpc_set_header nz-realip $remote_addr; # 如果你使用nginx作为最外层,就把上面一行注释掉,启用此行 grpc_read_timeout 600s; grpc_send_timeout 600s; grpc_socket_keepalive on; client_max_body_size 10m; grpc_buffer_size 4m; grpc_pass grpc://dashboard; } # websocket 相关 location ~* ^/api/v1/ws/(server|terminal|file)(.*)$ { proxy_set_header Host $host; proxy_set_header nz-realip $remote_addr; # 如果你使用nginx作为最外层,就把上面一行注释掉,启用此行 proxy_set_header Origin https://$host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_read_timeout 3600s; proxy_send_timeout 3600s; proxy_pass http://127.0.0.1:8008; } # web location / { proxy_set_header Host $host; proxy_set_header nz-realip $remote_addr; # 如果你使用nginx作为最外层,就把上面一行注释掉,启用此行 proxy_read_timeout 3600s; proxy_send_timeout 3600s; proxy_buffer_size 128k; proxy_buffers 4 256k; proxy_busy_buffers_size 256k; proxy_max_temp_file_size 0; proxy_set_header X-Forwarded-Proto $scheme; # 如果你使用nginx作为最外层,就启用此行避免无法正确读取访问的协议 proxy_pass http://127.0.0.1:8008; } } upstream dashboard { server 127.0.0.1:8008; keepalive 512; }