# Nginx 配置示例 # 将此配置添加到你的 Nginx 配置文件中 server { listen 80; listen [::]:80; server_name shellstack.910918920801.xyz; # 部署目录路径(请根据实际部署路径修改) root /var/www/shellstack; index shellstack.sh index.html; # 日志文件 access_log /var/log/nginx/shellstack_access.log; error_log /var/log/nginx/shellstack_error.log; # 主 location location / { try_files $uri $uri/ =404; # 允许执行 shell 脚本(通过下载方式) add_header Content-Type text/plain; add_header Content-Disposition "inline"; } # Shell 脚本文件特殊处理 location ~ \.sh$ { add_header Content-Type text/plain; add_header Content-Disposition "inline"; add_header X-Content-Type-Options "nosniff"; # 允许跨域(如果需要) # add_header Access-Control-Allow-Origin "*"; } # 禁止访问隐藏文件 location ~ /\. { deny all; access_log off; log_not_found off; } # 禁止访问 Git 目录 location ~ /\.git { deny all; access_log off; log_not_found off; } } # HTTPS 配置(推荐) # server { # listen 443 ssl http2; # listen [::]:443 ssl http2; # server_name shellstack.910918920801.xyz; # # ssl_certificate /path/to/ssl/cert.pem; # ssl_certificate_key /path/to/ssl/key.pem; # # root /var/www/shellstack; # index shellstack.sh index.html; # # location / { # try_files $uri $uri/ =404; # add_header Content-Type text/plain; # add_header Content-Disposition "inline"; # } # # location ~ \.sh$ { # add_header Content-Type text/plain; # add_header Content-Disposition "inline"; # } # }