I try to restrict the access to some laravel route path but still without success. Looks like the request is handled by error_page 404 definition because if I comment those line nginx show error 404.
http://admin.domain.com/accounts/login
This is my config
server {
listen 80;
server_name admin.domain.com;
error_page 404 = /index.php;
if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}
root /home/backend/admin/public;
access_log /home/backend/admin/logs/access.log;
error_log /home/backend/admin/logs/error.log;
location / {
index index.html index.htm index.php;
}
location ~ /accounts/login {
auth_basic "Protected Area";
auth_basic_user_file /etc/nginx/htpasswd;
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php/php7.0-fpm-admin.sock;
fastcgi_read_timeout 900s;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php/php7.0-fpm-admin.sock;
fastcgi_read_timeout 900s;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}