NGINX Configuration
Summary
Codeigniter 3
1
2
3
4
5
6
7
8
9
10
11
# Deny for accessing .htaccess files for Nginx
location ~ /\.ht {
deny all;
}
# Deny for accessing codes
location ~ ^/(application|system|tests|vendor)/ {
return 403;
}
disable php
URL match with another location. Post configure file.
Interchanging location(regular expressions are checked in the order defined in the configuration file):
1
2
3
4
5
6
7
8
9
# block access extension php inside folder
location ~ /views/(.+)\.php$ {
deny all;
}
location ~ \.php$ {
.....
1
2
3
4
5
6
7
8
9
10
#block access extension inside folder
location ~ /(uploads|assets)/ {
location ~* \.(php|phtml|php3|php4|php5|pl|py|jsp|asp|html|htm|shtml|sh|cgi|suspected)$ {
deny all;
}
}
location ~ \.php$ {
.....
Laravel
1
2
3
4
5
6
7
8
9
10
#block access extension inside folder
location ~ /(storage|assets|css|js|vendor)/ {
location ~* \.(php|phtml|php3|php4|php5|pl|py|jsp|asp|html|htm|shtml|sh|cgi|suspected)$ {
deny all;
}
}
location ~ \.php$ {
.....