Skip to content

Instantly share code, notes, and snippets.

@lazyjerry
Last active February 16, 2022 06:08
Show Gist options
  • Save lazyjerry/949e22ce4eac900bdc760d8be4294feb to your computer and use it in GitHub Desktop.
Save lazyjerry/949e22ce4eac900bdc760d8be4294feb to your computer and use it in GitHub Desktop.
最後更新日期 2022-02-16
# 線上測試網址:https://nginx.viraptor.info/
# 設定檔案 .git
location ~* \.(log|ini|real|cfg|env|env_sample|bak|bk|old|save|swp|svn|git|DS_Store|gitignore|disable|sample|lock|sh|bat) { deny all; }
# 設定檔案 e.g. user.ini
location ~ .*\.(log|ini|real|cfg|env|env_sample|bak|bk|old|save|swp|svn|git|DS_Store|gitignore|disable|sample|lock|sh|bat) { deny all; }
# Git 等版本控制 \ cache
location ~* \.(git|svn|cache|bin|logs|backup|tests)/.*$ { deny all; }
# composer 或是 license 等等指定檔案
location ~ /(\.user\.ini|license\.txt|LICENSE\.txt|composer\.lock|composer\.json|nginx\.conf|web\.config|htaccess\.txt|\.htaccess|goaccess_report\.html|LICENSE\.txt|composer\.lock|nginx\.conf|web\.config|htaccess\.txt|\.htaccess) { deny all; }
# 指定文本
location ~* \.(json|txt|docx|doc|xml|csv|xls|xlsb|xlsx) { deny all; }
# codeigniter 使用
location ~* /(system|vendors)/.*\.(txt|xml|md|html|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ { deny all; }
location ~* /application/.*\.(txt|md|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ { deny all; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment