protect dotenv file from being accessed #22

This commit is contained in:
printempw 2016-07-28 23:10:54 +08:00
parent 3107cc2bcb
commit 054c7d87ed
3 changed files with 22 additions and 2 deletions

View File

@ -4,3 +4,9 @@ RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php [L]
# Protect .env file
<Files .env>
Order allow,deny
Deny from all
</Files>

View File

@ -74,8 +74,7 @@ $ bower install
使用 gulp 构建前端代码:
```
$ gulp copy
$ gulp build
$ gulp copy && gulp build
```
可以开始使用啦~
@ -90,6 +89,12 @@ $ gulp build
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# Protect .env file
location ~ /\.env
{
deny all;
}
```
现在你可以访问 `http://example.com/{ player_name }.json` 来得到你的首选 API可在后台配置的 JSON 用户数据。另外一个 API 的 JSON 数据可以通过访问 `http://example.com/(usm|csl)/{ player_name }.json` 得到。

View File

@ -17,4 +17,13 @@
</rules>
</rewrite>
</system.webServer>
<!-- Protect .env file -->
<location path=".env">
<system.web>
<authorization>
<deny users="*"/>
</authorization>
</system.web>
</location>
</configuration>