Applicable to:
- Plesk for Linux
Question
How to prohibit access from a browser to specific file (e.g.
http//example.com/testdir/file.txt
)?
Answer
Forbidding access can be done using webserver's additional directives or .htaccess
file.
Log into Plesk go to Domains > example.com > Apache & nginx Settings and check the status of the option Serve static files directly by nginx:
-
Navigate to Domains > example.com > File manager
- Create a file
.htaccess
with the following directives:CONFIG_TEXT: <Files "file.txt">
Alternatevely navigate to Domains > example.com > Apache & nginx Settings and add the following nginx directive:
Order Allow,Deny
Deny from all
</Files>CONFIG_TEXT: location ^~ /test { auth_basic "Restricted";
auth_basic_user_file /var/www/vhosts/example.com/httodocs/testdir/.htpasswd;
}
Go to Domains > example.com > Apache & nginx Settings. And add the following directives to Additional nginx directives field:
CONFIG_TEXT: location = /testdir/file.txt {
deny all;
}
Comments
0 comments
Please sign in to leave a comment.