- HTTP Authorization in NGINX
location /admin/ {
auth_basic "Admin Zone";
auth_basic_user_file /var/www/example.com/admin/.htpasswd;
}
client_max_body_size 10m;
server{
listen 80;
server_name ~^(?<nginxhateyou>[\w]+\.steppefox)$;
root /home/steppefox/www/steppefox;
}
charset utf-8;
location / {
index index.html index.php;
try_files $uri $uri/ /index.php?$args;
}
location ~ ^/(protected|framework|themes/\w+/views) {
deny all;
}
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
try_files $uri =404;
}
location ~ \.php {
fastcgi_split_path_info ^(.+\.php)(.*)$;
set $fsn /index.php;
if (-f $document_root$fastcgi_script_name){
set $fsn $fastcgi_script_name;
}
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fsn;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fsn;
}
location ~ /\.ht {
deny all;
}