Files
2026-04-16 18:17:07 +08:00

73 lines
2.9 KiB
Plaintext

server
{{
{listen_ports}
server_name {domains};
index index.html index.htm default.htm default.html;
root {site_path};
#CERT-APPLY-CHECK--START
# Please do not delete the file verification configuration used for SSL certificate application
include /www/server/panel/vhost/nginx/well-known/{project_name}.conf;
#CERT-APPLY-CHECK--END
#SSL-START SSL-related configurations
#error_page 404/404.html;
{ssl_config}
#SSL-END
#ERROR-PAGE-START Error page related configuration
#error_page 404 /404.html;
#error_page 502 /502.html;
#ERROR-PAGE-END
#REWRITE-START Rewrite related configuration
include {panel_path}/vhost/rewrite/go_{project_name}.conf;
#REWRITE-END
# Prohibit access to sensitive files
location ~* (\.user.ini|\.htaccess|\.htpasswd|\.env.*|\.project|\.bashrc|\.bash_profile|\.bash_logout|\.DS_Store|\.gitignore|\.gitattributes|LICENSE|README\.md|CLAUDE\.md|CHANGELOG\.md|CHANGELOG|CONTRIBUTING\.md|TODO\.md|FAQ\.md|composer\.json|composer\.lock|package(-lock)?\.json|yarn\.lock|pnpm-lock\.yaml|\.\w+~|\.swp|\.swo|\.bak(up)?|\.old|\.tmp|\.temp|\.log|\.sql(\.gz)?|docker-compose\.yml|docker\.env|Dockerfile|\.csproj|\.sln|Cargo\.toml|Cargo\.lock|go\.mod|go\.sum|phpunit\.xml|phpunit\.xml|pom\.xml|build\.gradl|pyproject\.toml|requirements\.txt|application(-\w+)?\.(ya?ml|properties))$
{{
return 404;
}}
# Prohibit access to sensitive directories
location ~* /(\.git|\.svn|\.bzr|\.vscode|\.claude|\.idea|\.ssh|\.github|\.npm|\.yarn|\.pnpm|\.cache|\.husky|\.turbo|\.next|\.nuxt|node_modules|runtime)/ {{
return 404;
}}
# One-click SSL certificate verification directory related settings
location /.well-known/ {{
root /www/wwwroot/java_node_ssl;
}}
#Prohibit placing sensitive files in the certificate verification directory
if ( $uri ~ "^/\.well-known/.*\.(php|jsp|py|js|css|lua|ts|go|zip|tar\.gz|rar|7z|sql|bak)$" ) {{
return 403;
}}
# HTTP reverse proxy related configuration begins >>>
location ~ /purge(/.*) {{
proxy_cache_purge cache_one {host}$request_uri$is_args$args;
}}
location / {{
proxy_pass {url};
proxy_set_header Host {host};
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
add_header X-Cache $upstream_cache_status;
proxy_set_header X-Host $host:$server_port;
proxy_set_header X-Scheme $scheme;
proxy_connect_timeout 30s;
proxy_read_timeout 86400s;
proxy_send_timeout 30s;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}}
# HTTP reverse proxy related configuration completed <<<
access_log {log_path}/{project_name}.log;
error_log {log_path}/{project_name}.error.log;
}}