server { listen 80; listen [::]:80; server_name o.oo0o.ooo; # 让 https://o.oo0o.ooo/scripts/xxx 直接映射到 /root/scripts/xxx location /scripts/ { alias /root/scripts/; autoindex on; default_type text/plain; charset utf-8; types { text/plain sh conf yaml yml toml json txt md py js html css; } } location = / { return 301 https://$host/scripts/; } }